feat: switch to nanoid over uuid
This commit is contained in:
parent
ba54eda347
commit
beb2f2b61e
5 changed files with 20 additions and 4 deletions
|
|
@ -35,3 +35,6 @@ It seems like that legislation is more permissive when it comes to renting out a
|
|||
|
||||
### 8. Old houses with chargers for EVs
|
||||
There is this stark contrast between old wooden houses with a Tesla or some other modern EV parked in front and hooked up to a charger. It's funny.
|
||||
|
||||
### 9. A lappen is a lappen
|
||||
Apparently, a lappen can mean driver's license, which is exactly the same in German. Never once I expected to find this informal colloquialism anywhere outside the DACH area.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { APIContext } from "astro";
|
||||
import { drizzle } from "drizzle-orm/d1";
|
||||
import { cvTable } from "../../../../db/schema";
|
||||
import { nanoid } from "nanoid";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
|
|
@ -16,7 +17,7 @@ export async function POST(context: APIContext) {
|
|||
const purpose = formData.get("purpose") as string;
|
||||
const tooling = formData.get("tooling") as string;
|
||||
const created = new Date();
|
||||
const uuid = crypto.randomUUID();
|
||||
const uuid = nanoid(8);
|
||||
|
||||
try {
|
||||
await db
|
||||
|
|
@ -24,6 +25,7 @@ export async function POST(context: APIContext) {
|
|||
.values({ company_name, author, purpose, tooling, created, uuid })
|
||||
.execute();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return new Response(JSON.stringify({ success: false, error }));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import Verified from "../../components/verification/Verified.astro";
|
|||
import Revoked from "../../components/verification/Revoked.astro";
|
||||
|
||||
export const prerender = false;
|
||||
const uuid = Astro.url.searchParams.get("uuid");
|
||||
const id = Astro.url.searchParams.get("id");
|
||||
|
||||
const db = drizzle(Astro.locals.runtime.env.DB);
|
||||
|
||||
const cv = uuid
|
||||
? await db.select().from(cvTable).where(eq(cvTable.uuid, uuid))
|
||||
const cv = id
|
||||
? await db.select().from(cvTable).where(eq(cvTable.uuid, id))
|
||||
: [];
|
||||
---
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue