Bugfixes
This commit is contained in:
@@ -65,6 +65,9 @@ export const PUT = defineApiRoute({
|
||||
const ausweis = await adapter.findUnique({
|
||||
where: {
|
||||
id: ausweis_id
|
||||
},
|
||||
include: {
|
||||
rechnung: true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -75,6 +78,13 @@ export const PUT = defineApiRoute({
|
||||
});
|
||||
}
|
||||
|
||||
if (ausweis.rechnung) {
|
||||
throw new APIError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Eine Rechnung für diesen Ausweis existiert bereits.",
|
||||
});
|
||||
}
|
||||
|
||||
if (ausweis.benutzer_id !== user.id) {
|
||||
throw new APIError({
|
||||
code: "UNAUTHORIZED",
|
||||
|
||||
Reference in New Issue
Block a user