Ausweis erstellen

This commit is contained in:
Moritz Utcke
2025-04-29 10:39:11 -03:00
parent e24310bdb7
commit a8be6db8aa
42 changed files with 377 additions and 239 deletions

View File

@@ -1,9 +1,9 @@
import { z } from "zod";
import { prisma } from "#lib/server/prisma.js";
import { defineApiRoute } from "astro-typesafe-api/server";
import { UUidWithPrefix } from "#components/Ausweis/types.js";
import { IDWithPrefix } from "#components/Ausweis/types.js";
import { TicketsSchema } from "src/generated/zod/tickets.js";
import { generatePrefixedId } from "#lib/db.js";
import { generateIDWithPrefix } from "#lib/db.js";
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
export const PUT = defineApiRoute({
@@ -25,10 +25,10 @@ export const PUT = defineApiRoute({
updated_at: true,
}),
output: z.object({
id: UUidWithPrefix,
id: IDWithPrefix,
}),
async fetch(input, ctx) {
const id = generatePrefixedId(9, VALID_UUID_PREFIXES.Ticket)
const id = generateIDWithPrefix(9, VALID_UUID_PREFIXES.Ticket)
const ticket = await prisma.tickets.create({
data: {