feat: switch to nanoid over uuid

This commit is contained in:
Alexander Daichendt 2025-01-01 22:36:29 +01:00
parent ba54eda347
commit beb2f2b61e
5 changed files with 20 additions and 4 deletions

39
src/pages/cv/index.astro Normal file
View file

@ -0,0 +1,39 @@
---
import { eq } from "drizzle-orm";
import { drizzle } from "drizzle-orm/d1";
import { cvTable } from "../../db/schema";
import BaseLayout from "../../layouts/BaseLayout.astro";
import DataTable from "../../components/verification/DataTable.astro";
import NoCV from "../../components/verification/NoCV.astro";
import Verified from "../../components/verification/Verified.astro";
import Revoked from "../../components/verification/Revoked.astro";
export const prerender = false;
const id = Astro.url.searchParams.get("id");
const db = drizzle(Astro.locals.runtime.env.DB);
const cv = id
? await db.select().from(cvTable).where(eq(cvTable.uuid, id))
: [];
---
<BaseLayout title="CV Verification">
<section class="max-w-4xl mx-auto min-h-screen">
{
cv.length === 0 ? (
<NoCV />
) : cv[0].status !== "active" ? (
<div class="text-center p-8 bg-red-50 dark:bg-red-950 rounded-lg shadow-sm">
<Revoked />
<DataTable cv={cv[0]} />
</div>
) : (
<div class="bg-white dark:bg-gray-800 p-8 rounded-lg shadow-lg">
<Verified cv={cv[0]} />
<DataTable cv={cv[0]} />
</div>
)
}
</section>
</BaseLayout>