Skip to content

Commit

Permalink
Updated backend to retrieve pdb file path, length and mass
Browse files Browse the repository at this point in the history
  • Loading branch information
CoraBailey committed Nov 17, 2023
1 parent 9785314 commit 569caaa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions backend/src/api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class CamelModel(BaseModel):
class ProteinEntry(CamelModel):
name: str
id: str
filePDBAlphaFold: str
length: int
mass: float


class AllEntries(CamelModel):
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/openapi/models/ProteinEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
export type ProteinEntry = {
name: string;
id: string;
filePDBAlphaFold: string;
length: number;
mass: number;
};

3 changes: 2 additions & 1 deletion frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import { goto } from "$app/navigation";
import { Backend } from "$lib/backend";
import type { ProteinEntry } from "$lib/backend";
console.log("Hello World")
// at some point, this should be change to request from the backend
let allEntries: ProteinEntry[] | null = null;
onMount(async () => {
// calls get_all_entries() from backend
// to generate this Backend object run `./run.sh gen_api` for newly created server functions
allEntries = await Backend.getAllEntries();
console.log(allEntries)
});
</script>

Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/protein/[proteinId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
console.log("Requesting", data.proteinId, "info from backend");
entry = await Backend.getProteinEntry(data.proteinId);
// if we could not find the entry, the id is garbo
if (entry == null) error = true;
Expand Down

0 comments on commit 569caaa

Please sign in to comment.