Bildupload und Kundendaten

This commit is contained in:
Moritz Utcke
2025-01-22 15:29:11 +07:00
parent 46ef96becd
commit bd60df1ef4
29 changed files with 168 additions and 103 deletions

View File

@@ -1,4 +1,4 @@
import { VerbrauchsausweisWohnenClient, ZodOverlap } from "#components/Ausweis/types.js";
import { OptionalNullable, VerbrauchsausweisWohnenClient, ZodOverlap } from "#components/Ausweis/types.js";
import { exclude } from "#lib/exclude.js";
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
import { prisma, VerbrauchsausweisWohnenSchema } from "@ibcornelsen/database/server";
@@ -60,7 +60,7 @@ export const GET = defineApiRoute({
}
}
},
output: ZodOverlap<VerbrauchsausweisWohnenClient>(VerbrauchsausweisWohnenSchema.merge(z.object({
output: ZodOverlap<OptionalNullable<VerbrauchsausweisWohnenClient>>(VerbrauchsausweisWohnenSchema.merge(z.object({
uid_aufnahme: z.string().uuid(),
uid_objekt: z.string().uuid(),
uid_benutzer: z.string().uuid().optional()
@@ -73,8 +73,12 @@ export const GET = defineApiRoute({
async fetch(input, context, user) {
const { uid } = context.params;
console.log(uid);
if (!uid) {
throw new APIError({
code: "BAD_REQUEST",
message: "Missing uid in request params"
})
}
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
where: {