diff --git a/prisma/migrations/20250405131537_mime/migration.sql b/prisma/migrations/20250405131537_mime/migration.sql
new file mode 100644
index 00000000..5950a2bf
--- /dev/null
+++ b/prisma/migrations/20250405131537_mime/migration.sql
@@ -0,0 +1,20 @@
+/*
+ Warnings:
+
+ - You are about to drop the column `alte_ausweis_id` on the `BedarfsausweisWohnen` table. All the data in the column will be lost.
+ - You are about to drop the column `alte_ausweis_id` on the `VerbrauchsausweisGewerbe` table. All the data in the column will be lost.
+ - You are about to drop the column `alte_ausweis_id` on the `VerbrauchsausweisWohnen` table. All the data in the column will be lost.
+ - Made the column `mime` on table `Unterlage` required. This step will fail if there are existing NULL values in that column.
+
+*/
+-- AlterTable
+ALTER TABLE "BedarfsausweisWohnen" DROP COLUMN "alte_ausweis_id";
+
+-- AlterTable
+ALTER TABLE "Unterlage" ALTER COLUMN "mime" SET NOT NULL;
+
+-- AlterTable
+ALTER TABLE "VerbrauchsausweisGewerbe" DROP COLUMN "alte_ausweis_id";
+
+-- AlterTable
+ALTER TABLE "VerbrauchsausweisWohnen" DROP COLUMN "alte_ausweis_id";
diff --git a/prisma/schema/BedarfsausweisWohnen.prisma b/prisma/schema/BedarfsausweisWohnen.prisma
index 5dbbf3e9..b93c9021 100644
--- a/prisma/schema/BedarfsausweisWohnen.prisma
+++ b/prisma/schema/BedarfsausweisWohnen.prisma
@@ -1,7 +1,6 @@
model BedarfsausweisWohnen {
id String @id @unique @db.VarChar(8)
- alte_ausweis_id Int?
benutzer_id String?
ausstellgrund Ausstellgrund?
registriernummer String? @db.VarChar
diff --git a/prisma/schema/Unterlage.prisma b/prisma/schema/Unterlage.prisma
index af8cb225..0c8d7053 100644
--- a/prisma/schema/Unterlage.prisma
+++ b/prisma/schema/Unterlage.prisma
@@ -8,7 +8,7 @@ model Unterlage {
id String @id @unique @db.VarChar(8)
name String?
kategorie String?
- mime String?
+ mime String
aufnahme_id String?
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
diff --git a/prisma/schema/VerbrauchsausweisGewerbe.prisma b/prisma/schema/VerbrauchsausweisGewerbe.prisma
index c544fb68..6ee79261 100644
--- a/prisma/schema/VerbrauchsausweisGewerbe.prisma
+++ b/prisma/schema/VerbrauchsausweisGewerbe.prisma
@@ -1,7 +1,6 @@
model VerbrauchsausweisGewerbe {
id String @id @unique @db.VarChar(8)
- alte_ausweis_id Int?
ausstellgrund Ausstellgrund?
registriernummer String? @db.VarChar
zusaetzliche_heizquelle Boolean?
diff --git a/prisma/schema/VerbrauchsausweisWohnen.prisma b/prisma/schema/VerbrauchsausweisWohnen.prisma
index ca44544b..73e3a7f3 100644
--- a/prisma/schema/VerbrauchsausweisWohnen.prisma
+++ b/prisma/schema/VerbrauchsausweisWohnen.prisma
@@ -2,7 +2,6 @@
model VerbrauchsausweisWohnen {
/// @zod.describe("ID des Ausweises")
id String @id @unique @db.VarChar(8)
- alte_ausweis_id Int?
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
ausstellgrund Ausstellgrund?
/// @zod.describe("Die Registriernummer des Ausweises")
diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts
index 09cb4310..f3b7b0ed 100644
--- a/src/astro-typesafe-api-caller.ts
+++ b/src/astro-typesafe-api-caller.ts
@@ -5,6 +5,10 @@ export const createCaller = createCallerFactory({
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
"unterlage": await import("../src/pages/api/unterlage.ts"),
+ "ausweise": await import("../src/pages/api/ausweise/index.ts"),
+ "auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
+ "auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
+ "auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
"admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"),
@@ -12,13 +16,9 @@ export const createCaller = createCallerFactory({
"admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"),
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
- "aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
- "auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
- "auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
- "auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
- "ausweise": await import("../src/pages/api/ausweise/index.ts"),
"bedarfsausweis-gewerbe/[id]": await import("../src/pages/api/bedarfsausweis-gewerbe/[id].ts"),
"bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
+ "aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
"bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"),
"bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
"bilder/[id]": await import("../src/pages/api/bilder/[id].ts"),
diff --git a/src/client/lib/nachweisSpeichern.ts b/src/client/lib/nachweisSpeichern.ts
index 083839e8..b5243e33 100644
--- a/src/client/lib/nachweisSpeichern.ts
+++ b/src/client/lib/nachweisSpeichern.ts
@@ -3,15 +3,15 @@ import { api } from "astro-typesafe-api/client"
import { exclude } from "#lib/exclude.js";
import Cookies from "js-cookie";
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
-import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, UnterlageClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js";
-import { BedarfsausweisGewerbe, Enums, GEGNachweisGewerbe, GEGNachweisWohnen } from "#lib/client/prisma.js";
+import { AufnahmeClient, BildClient, ObjektClient, } from "#components/Ausweis/types.js";
+import { BedarfsausweisGewerbe, Enums, GEGNachweisGewerbe, GEGNachweisWohnen, Unterlage } from "#lib/client/prisma.js";
export async function nachweisSpeichern(
nachweis: BedarfsausweisGewerbe | GEGNachweisWohnen | GEGNachweisGewerbe,
objekt: ObjektClient,
aufnahme: AufnahmeClient,
bilder: BildClient[],
- unterlagen: UnterlageClient[],
+ unterlagen: Unterlage[],
ausweisart: Enums.Ausweisart
) {
if (objekt.id) {
@@ -213,6 +213,17 @@ export async function nachweisSpeichern(
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
}
})
+ console.log(unterlagen);
+
+
+ await api.aufnahme._id.unterlagen.PUT.fetch(unterlagen.map(unterlage => unterlage.id), {
+ params: {
+ id: aufnahme.id
+ },
+ headers: {
+ "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
+ }
+ })
return {
nachweis_id: nachweis.id,
diff --git a/src/components/Ausweis/Ausweisart.svelte b/src/components/Ausweis/Ausweisart.svelte
index 5793e335..2715882c 100644
--- a/src/components/Ausweis/Ausweisart.svelte
+++ b/src/components/Ausweis/Ausweisart.svelte
@@ -49,7 +49,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
required
data-cy="ausstellgrund"
>
-
+
{#each ausstellgrund as name}
{/each}
@@ -225,7 +225,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
required
bind:value={aufnahme.saniert}
>
-
+
diff --git a/src/components/Ausweis/ButtonWeiterHilfe.svelte b/src/components/Ausweis/ButtonWeiterHilfe.svelte
index d266ef6d..a1339721 100644
--- a/src/components/Ausweis/ButtonWeiterHilfe.svelte
+++ b/src/components/Ausweis/ButtonWeiterHilfe.svelte
@@ -1,18 +1,18 @@