diff --git a/apps/api/src/server.ts b/apps/api/src/server.ts index 1514423..dc85239 100644 --- a/apps/api/src/server.ts +++ b/apps/api/src/server.ts @@ -616,7 +616,16 @@ export const app = new Elysia() .get("/:id", async ({ params: { id } }) => { const verification = await s.Verifications.get(id); if (!verification) return status(404, { error: "Verification not found" }); - return verification; + + const { contents = [] } = await r2.verificationMedia.list({ prefix: `${verification.assessment_id}/` }); + const media = contents.map(({ key, size, lastModified }) => ({ + key, + size, + lastModified, + url: r2.verificationMedia.presign(key, { expiresIn: 60 * 60 }), + })); + + return { ...verification, media }; }, { params: t.Object({ id: BigIntIdSchema }) }) diff --git a/apps/portal/src/routes/(app)/+layout.svelte b/apps/portal/src/routes/(app)/+layout.svelte index dfd81d6..56da58d 100644 --- a/apps/portal/src/routes/(app)/+layout.svelte +++ b/apps/portal/src/routes/(app)/+layout.svelte @@ -28,7 +28,7 @@ { name: "Verification", path: "/verification", - links: [{ name: "Requests", path: "/requests" }], + links: [{ name: "Verifications", path: "/verifications" }], }, ]; diff --git a/apps/portal/src/routes/(app)/verification/requests/[id]/+page.svelte b/apps/portal/src/routes/(app)/verification/requests/[id]/+page.svelte deleted file mode 100644 index 490c977..0000000 --- a/apps/portal/src/routes/(app)/verification/requests/[id]/+page.svelte +++ /dev/null @@ -1,471 +0,0 @@ - - -
- ← Back to requests -
- -{#if loading} -
- -
-{:else if loadError} - -{:else if verification} - {@const v = verification} -
-

{v.name}

-
{v.status}
- {v.gender} · age {v.age} · {Math.round(kgToLb(v.weight))} lb -
- {reviewedCount} / {ACTIVITIES.length} reviewed -
- -
- {#each ACTIVITIES as activity, i (activity)} - - {/each} - -
- - {#if !isSummaryStep} - {@const activity = ACTIVITIES[stepIndex]} -
-
-

{activity}

-
-
Claimed
-
- {formatPerformance(activity, v[PERF_COLUMN[activity]])} -
-
-
- - {#if v[MEDIA_KEY_COLUMN[activity]]} - {@const videoUrl = v[MEDIA_KEY_COLUMN[activity]]} - - - - Open video in new tab - - {:else} -
- No video uploaded -
- {/if} - -
- - - -
- -
- - -
-
- {:else} -
-

Review summary

- -
- - - - - - - - - - - {#each ACTIVITIES as activity, i (activity)} - - - - - - - {/each} - -
ActivityClaimedVideoResult
- - - {formatPerformance( - activity, - v[PERF_COLUMN[activity]], - )} - - {#if v[MEDIA_KEY_COLUMN[activity]]} - - View - - {:else} - None - {/if} - - {#if verf[activity] === "pass"} - Pass - {:else if verf[activity] === "fail"} - Fail - {:else} - Unreviewed - {/if} -
-
- - - - {#if submitError} - - {/if} - -
- - - {#if isReadOnly} - - {v.status === "completed" - ? "This verification is completed and read-only." - : v.status === "draft" - ? "This verification is still a draft (the player hasn't finished uploading) and is read-only." - : "This verification is waiting on the player to resubmit and is read-only."} - - {:else} -
- {#if !allReviewed} - Mark every activity Pass or Fail to complete - {/if} - - -
- {/if} -
-
- {/if} -{/if} diff --git a/apps/portal/src/routes/(app)/verification/requests/+page.svelte b/apps/portal/src/routes/(app)/verification/verifications/+page.svelte similarity index 79% rename from apps/portal/src/routes/(app)/verification/requests/+page.svelte rename to apps/portal/src/routes/(app)/verification/verifications/+page.svelte index 6e96e3a..cb76502 100644 --- a/apps/portal/src/routes/(app)/verification/requests/+page.svelte +++ b/apps/portal/src/routes/(app)/verification/verifications/+page.svelte @@ -1,6 +1,5 @@ + +
+ ← Back to verifications +
+ +{#if loading} +
+ +
+{:else if loadError} + +{:else if verification} + {@const v = verification} +
+

{v.name}

+
+ {v.status} +
+ {v.gender} · age {v.age} · {Math.round(kgToLb(v.weight))} lb +
+ +
+
+

Activities

+ {reviewedCount} / {ACTIVITIES.length} reviewed +
+ +
+ + + + + + + + + + {#each ACTIVITIES as activity (activity)} + + + + + + {/each} + +
ActivityClaimedResult
{activity} + {formatPerformance( + activity, + v[PERF_COLUMN[activity]], + )} + +
+ + +
+
+
+
+ +
+

Media ({v.media.length})

+ + {#if v.media.length === 0} + No media uploaded + {:else} + + {/if} +
+ +
+ + + {#if submitError} + + {/if} + +
+ {#if isReadOnly} + + {v.status === "completed" + ? "This verification is completed and read-only." + : v.status === "draft" + ? "This verification is still a draft (the player hasn't finished uploading) and is read-only." + : "This verification is waiting on the player to resubmit and is read-only."} + + {:else} + {#if !allReviewed} + Mark every activity Pass or Fail to complete + {/if} + + + {/if} +
+
+{/if}