feat: switch to nanoid over uuid
This commit is contained in:
parent
ba54eda347
commit
beb2f2b61e
5 changed files with 20 additions and 4 deletions
|
|
@ -30,6 +30,7 @@
|
|||
"astro-icon": "^1.1.4",
|
||||
"drizzle-orm": "^0.38.3",
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"nanoid": "^5.0.9",
|
||||
"reading-time": "^1.5.0",
|
||||
"sharp": "^0.33.5",
|
||||
"tailwindcss": "^3.4.16",
|
||||
|
|
|
|||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
|
|
@ -50,6 +50,9 @@ importers:
|
|||
mdast-util-to-string:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0
|
||||
nanoid:
|
||||
specifier: ^5.0.9
|
||||
version: 5.0.9
|
||||
reading-time:
|
||||
specifier: ^1.5.0
|
||||
version: 1.5.0
|
||||
|
|
@ -2565,6 +2568,11 @@ packages:
|
|||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
nanoid@5.0.9:
|
||||
resolution: {integrity: sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==}
|
||||
engines: {node: ^18 || >=20}
|
||||
hasBin: true
|
||||
|
||||
napi-build-utils@1.0.2:
|
||||
resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==}
|
||||
|
||||
|
|
@ -6200,6 +6208,8 @@ snapshots:
|
|||
|
||||
nanoid@3.3.8: {}
|
||||
|
||||
nanoid@5.0.9: {}
|
||||
|
||||
napi-build-utils@1.0.2: {}
|
||||
|
||||
neotraverse@0.6.18: {}
|
||||
|
|
|
|||
|
|
@ -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