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,6 +1,6 @@
import { UUidWithPrefix } from "#components/Ausweis/types.js";
import { IDWithPrefix } from "#components/Ausweis/types.js";
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
import { generatePrefixedId } from "#lib/db.js";
import { generateIDWithPrefix } from "#lib/db.js";
import { exclude } from "#lib/exclude.js";
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
import { sendAusweisGespeichertMail } from "#lib/server/mail/speichern-erfolgreich.js";
@@ -64,7 +64,7 @@ export const DELETE = defineApiRoute({
async fetch(input, ctx, user) {
const { id } = ctx.params;
if (!UUidWithPrefix.safeParse(id).success) {
if (!IDWithPrefix.safeParse(id).success) {
throw new APIError({
code: "BAD_REQUEST",
message: "UID konnte nicht verifiziert werden."
@@ -122,7 +122,7 @@ export const DELETE = defineApiRoute({
}
})
const event_id = generatePrefixedId(9, VALID_UUID_PREFIXES.Ticket)
const event_id = generateIDWithPrefix(9, VALID_UUID_PREFIXES.Ticket)
// Wir erstellen ein Event, dass der Nachweis storniert wurde
// Dann können wir das in der Historie anzeigen
@@ -164,9 +164,9 @@ export const GET = defineApiRoute({
}
},
output: BedarfsausweisGewerbeSchema.merge(z.object({
aufnahme_id: UUidWithPrefix,
objekt_id: UUidWithPrefix,
benutzer_id: UUidWithPrefix.optional()
aufnahme_id: IDWithPrefix,
objekt_id: IDWithPrefix,
benutzer_id: IDWithPrefix.optional()
})).omit({
id: true,
aufnahme_id: true,