diff --git a/package-lock.json b/package-lock.json index b063bee..4dccee2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "praktikum", "version": "0.0.1", "dependencies": { - "@prisma/client": "^6.8.2", + "@prisma/client": "^6.9.0", "@sveltejs/adapter-node": "^5.2.12", "bcryptjs": "^3.0.2" }, @@ -28,7 +28,7 @@ "postcss": "^8.5.3", "prettier": "^3.4.2", "prettier-plugin-svelte": "^3.3.3", - "prisma": "^6.8.2", + "prisma": "^6.9.0", "svelte": "^5.0.0", "svelte-check": "^4.0.0", "tailwindcss": "^3.4.17", @@ -859,9 +859,9 @@ "license": "MIT" }, "node_modules/@prisma/client": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.8.2.tgz", - "integrity": "sha512-5II+vbyzv4si6Yunwgkj0qT/iY0zyspttoDrL3R4BYgLdp42/d2C8xdi9vqkrYtKt9H32oFIukvyw3Koz5JoDg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.9.0.tgz", + "integrity": "sha512-Gg7j1hwy3SgF1KHrh0PZsYvAaykeR0PaxusnLXydehS96voYCGt1U5zVR31NIouYc63hWzidcrir1a7AIyCsNQ==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { @@ -881,9 +881,9 @@ } }, "node_modules/@prisma/config": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.8.2.tgz", - "integrity": "sha512-ZJY1fF4qRBPdLQ/60wxNtX+eu89c3AkYEcP7L3jkp0IPXCNphCYxikTg55kPJLDOG6P0X+QG5tCv6CmsBRZWFQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.9.0.tgz", + "integrity": "sha512-Wcfk8/lN3WRJd5w4jmNQkUwhUw0eksaU/+BlAJwPQKW10k0h0LC9PD/6TQFmqKVbHQL0vG2z266r0S1MPzzhbA==", "devOptional": true, "license": "Apache-2.0", "dependencies": { @@ -891,53 +891,53 @@ } }, "node_modules/@prisma/debug": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.8.2.tgz", - "integrity": "sha512-4muBSSUwJJ9BYth5N8tqts8JtiLT8QI/RSAzEogwEfpbYGFo9mYsInsVo8dqXdPO2+Rm5OG5q0qWDDE3nyUbVg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.9.0.tgz", + "integrity": "sha512-bFeur/qi/Q+Mqk4JdQ3R38upSYPebv5aOyD1RKywVD+rAMLtRkmTFn28ZuTtVOnZHEdtxnNOCH+bPIeSGz1+Fg==", "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.8.2.tgz", - "integrity": "sha512-XqAJ//LXjqYRQ1RRabs79KOY4+v6gZOGzbcwDQl0D6n9WBKjV7qdrbd042CwSK0v0lM9MSHsbcFnU2Yn7z8Zlw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.9.0.tgz", + "integrity": "sha512-im0X0bwDLA0244CDf8fuvnLuCQcBBdAGgr+ByvGfQY9wWl6EA+kRGwVk8ZIpG65rnlOwtaWIr/ZcEU5pNVvq9g==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.8.2", - "@prisma/engines-version": "6.8.0-43.2060c79ba17c6bb9f5823312b6f6b7f4a845738e", - "@prisma/fetch-engine": "6.8.2", - "@prisma/get-platform": "6.8.2" + "@prisma/debug": "6.9.0", + "@prisma/engines-version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "@prisma/fetch-engine": "6.9.0", + "@prisma/get-platform": "6.9.0" } }, "node_modules/@prisma/engines-version": { - "version": "6.8.0-43.2060c79ba17c6bb9f5823312b6f6b7f4a845738e", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.8.0-43.2060c79ba17c6bb9f5823312b6f6b7f4a845738e.tgz", - "integrity": "sha512-Rkik9lMyHpFNGaLpPF3H5q5TQTkm/aE7DsGM5m92FZTvWQsvmi6Va8On3pWvqLHOt5aPUvFb/FeZTmphI4CPiQ==", + "version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e.tgz", + "integrity": "sha512-Qp9gMoBHgqhKlrvumZWujmuD7q4DV/gooEyPCLtbkc13EZdSz2RsGUJ5mHb3RJgAbk+dm6XenqG7obJEhXcJ6Q==", "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.8.2.tgz", - "integrity": "sha512-lCvikWOgaLOfqXGacEKSNeenvj0n3qR5QvZUOmPE2e1Eh8cMYSobxonCg9rqM6FSdTfbpqp9xwhSAOYfNqSW0g==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.9.0.tgz", + "integrity": "sha512-PMKhJdl4fOdeE3J3NkcWZ+tf3W6rx3ht/rLU8w4SXFRcLhd5+3VcqY4Kslpdm8osca4ej3gTfB3+cSk5pGxgFg==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.8.2", - "@prisma/engines-version": "6.8.0-43.2060c79ba17c6bb9f5823312b6f6b7f4a845738e", - "@prisma/get-platform": "6.8.2" + "@prisma/debug": "6.9.0", + "@prisma/engines-version": "6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e", + "@prisma/get-platform": "6.9.0" } }, "node_modules/@prisma/get-platform": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.8.2.tgz", - "integrity": "sha512-vXSxyUgX3vm1Q70QwzwkjeYfRryIvKno1SXbIqwSptKwqKzskINnDUcx85oX+ys6ooN2ATGSD0xN2UTfg6Zcow==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.9.0.tgz", + "integrity": "sha512-/B4n+5V1LI/1JQcHp+sUpyRT1bBgZVPHbsC4lt4/19Xp4jvNIVcq5KYNtQDk5e/ukTSjo9PZVAxxy9ieFtlpTQ==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.8.2" + "@prisma/debug": "6.9.0" } }, "node_modules/@rollup/plugin-commonjs": { @@ -4209,15 +4209,15 @@ } }, "node_modules/prisma": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.8.2.tgz", - "integrity": "sha512-JNricTXQxzDtRS7lCGGOB4g5DJ91eg3nozdubXze3LpcMl1oWwcFddrj++Up3jnRE6X/3gB/xz3V+ecBk/eEGA==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.9.0.tgz", + "integrity": "sha512-resJAwMyZREC/I40LF6FZ6rZTnlrlrYrb63oW37Gq+U+9xHwbyMSPJjKtM7VZf3gTO86t/Oyz+YeSXr3CmAY1Q==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/config": "6.8.2", - "@prisma/engines": "6.8.2" + "@prisma/config": "6.9.0", + "@prisma/engines": "6.9.0" }, "bin": { "prisma": "build/index.js" diff --git a/package.json b/package.json index 2a32354..3f45dbf 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "postcss": "^8.5.3", "prettier": "^3.4.2", "prettier-plugin-svelte": "^3.3.3", - "prisma": "^6.8.2", + "prisma": "^6.9.0", "svelte": "^5.0.0", "svelte-check": "^4.0.0", "tailwindcss": "^3.4.17", @@ -43,7 +43,7 @@ "vite-plugin": "^0.0.0" }, "dependencies": { - "@prisma/client": "^6.8.2", + "@prisma/client": "^6.9.0", "@sveltejs/adapter-node": "^5.2.12", "bcryptjs": "^3.0.2" } diff --git a/prisma/migrations/20250604135706_noten_und_sozialverhalten/migration.sql b/prisma/migrations/20250604135706_noten_und_sozialverhalten/migration.sql new file mode 100644 index 0000000..7fddbc6 --- /dev/null +++ b/prisma/migrations/20250604135706_noten_und_sozialverhalten/migration.sql @@ -0,0 +1,46 @@ +/* + Warnings: + + - You are about to drop the column `zeitraum` on the `Anmeldung` table. All the data in the column will be lost. + - Added the required column `noteDeutsch` to the `Anmeldung` table without a default value. This is not possible if the table is not empty. + - Added the required column `noteMathe` to the `Anmeldung` table without a default value. This is not possible if the table is not empty. + - Added the required column `sozialverhalten` to the `Anmeldung` table without a default value. This is not possible if the table is not empty. + - Made the column `praktikumId` on table `Anmeldung` required. This step will fail if there are existing NULL values in that column. + +*/ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Anmeldung" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "anrede" TEXT NOT NULL, + "vorname" TEXT NOT NULL, + "nachname" TEXT NOT NULL, + "geburtsdatum" TEXT NOT NULL, + "strasse" TEXT NOT NULL, + "hausnummer" TEXT NOT NULL, + "ort" TEXT NOT NULL, + "plz" TEXT NOT NULL, + "telefon" TEXT NOT NULL, + "email" TEXT NOT NULL, + "noteDeutsch" INTEGER NOT NULL, + "noteMathe" INTEGER NOT NULL, + "sozialverhalten" TEXT NOT NULL, + "schulart" TEXT NOT NULL, + "motivation" TEXT NOT NULL, + "praktikumId" INTEGER NOT NULL, + "wunsch1Id" INTEGER NOT NULL, + "wunsch2Id" INTEGER NOT NULL, + "wunsch3Id" INTEGER NOT NULL, + "timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "Anmeldung_praktikumId_fkey" FOREIGN KEY ("praktikumId") REFERENCES "Praktikumszeitraum" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT "Anmeldung_wunsch1Id_fkey" FOREIGN KEY ("wunsch1Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT "Anmeldung_wunsch2Id_fkey" FOREIGN KEY ("wunsch2Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT "Anmeldung_wunsch3Id_fkey" FOREIGN KEY ("wunsch3Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); +INSERT INTO "new_Anmeldung" ("anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "ort", "plz", "praktikumId", "schulart", "strasse", "telefon", "timestamp", "vorname", "wunsch1Id", "wunsch2Id", "wunsch3Id") SELECT "anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "ort", "plz", "praktikumId", "schulart", "strasse", "telefon", "timestamp", "vorname", "wunsch1Id", "wunsch2Id", "wunsch3Id" FROM "Anmeldung"; +DROP TABLE "Anmeldung"; +ALTER TABLE "new_Anmeldung" RENAME TO "Anmeldung"; +CREATE UNIQUE INDEX "Anmeldung_email_key" ON "Anmeldung"("email"); +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/prisma/migrations/20250604142543_praktikum_id_only/migration.sql b/prisma/migrations/20250604142543_praktikum_id_only/migration.sql new file mode 100644 index 0000000..70f26e8 --- /dev/null +++ b/prisma/migrations/20250604142543_praktikum_id_only/migration.sql @@ -0,0 +1,35 @@ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_Anmeldung" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "anrede" TEXT NOT NULL, + "vorname" TEXT NOT NULL, + "nachname" TEXT NOT NULL, + "geburtsdatum" TEXT NOT NULL, + "strasse" TEXT NOT NULL, + "hausnummer" TEXT NOT NULL, + "ort" TEXT NOT NULL, + "plz" TEXT NOT NULL, + "telefon" TEXT NOT NULL, + "email" TEXT NOT NULL, + "noteDeutsch" INTEGER NOT NULL, + "noteMathe" INTEGER NOT NULL, + "sozialverhalten" TEXT NOT NULL, + "schulart" TEXT NOT NULL, + "motivation" TEXT NOT NULL, + "praktikumId" INTEGER NOT NULL, + "wunsch1Id" INTEGER NOT NULL, + "wunsch2Id" INTEGER NOT NULL, + "wunsch3Id" INTEGER NOT NULL, + "timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "Anmeldung_wunsch1Id_fkey" FOREIGN KEY ("wunsch1Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT "Anmeldung_wunsch2Id_fkey" FOREIGN KEY ("wunsch2Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, + CONSTRAINT "Anmeldung_wunsch3Id_fkey" FOREIGN KEY ("wunsch3Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); +INSERT INTO "new_Anmeldung" ("anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "noteDeutsch", "noteMathe", "ort", "plz", "praktikumId", "schulart", "sozialverhalten", "strasse", "telefon", "timestamp", "vorname", "wunsch1Id", "wunsch2Id", "wunsch3Id") SELECT "anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "noteDeutsch", "noteMathe", "ort", "plz", "praktikumId", "schulart", "sozialverhalten", "strasse", "telefon", "timestamp", "vorname", "wunsch1Id", "wunsch2Id", "wunsch3Id" FROM "Anmeldung"; +DROP TABLE "Anmeldung"; +ALTER TABLE "new_Anmeldung" RENAME TO "Anmeldung"; +CREATE UNIQUE INDEX "Anmeldung_email_key" ON "Anmeldung"("email"); +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/prisma/praktika.db-journal b/prisma/praktika.db-journal new file mode 100644 index 0000000..618c404 Binary files /dev/null and b/prisma/praktika.db-journal differ diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 45e2a9a..a1dc900 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -28,37 +28,37 @@ model Praktikumszeitraum { bezeichnung String @unique // z. B. "Frühjahr 2025" startDatum DateTime endDatum DateTime - anmeldungen Anmeldung[] } model Anmeldung { - id Int @id @default(autoincrement()) - anrede String - vorname String - nachname String - geburtsdatum String - strasse String - hausnummer String - ort String - plz String - telefon String - email String @unique - schulart String - motivation String + id Int @id @default(autoincrement()) + anrede String + vorname String + nachname String + geburtsdatum String + strasse String + hausnummer String + ort String + plz String + telefon String + email String @unique + noteDeutsch Int + noteMathe Int + sozialverhalten String + schulart String + motivation String - praktikumId Int - praktikum Praktikumszeitraum @relation(fields: [praktikumId], references: [id]) + praktikumId Int + wunsch1Id Int + wunsch2Id Int + wunsch3Id Int - wunsch1Id Int - wunsch2Id Int - wunsch3Id Int + wunsch1 Dienststelle @relation("Wunsch1", fields: [wunsch1Id], references: [id]) + wunsch2 Dienststelle @relation("Wunsch2", fields: [wunsch2Id], references: [id]) + wunsch3 Dienststelle @relation("Wunsch3", fields: [wunsch3Id], references: [id]) - wunsch1 Dienststelle @relation("Wunsch1", fields: [wunsch1Id], references: [id]) - wunsch2 Dienststelle @relation("Wunsch2", fields: [wunsch2Id], references: [id]) - wunsch3 Dienststelle @relation("Wunsch3", fields: [wunsch3Id], references: [id]) - - timestamp DateTime @default(now()) + timestamp DateTime @default(now()) pdfs PdfDatei[] @relation("AnmeldungPdfs") } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index f2ae043..2d0c3a0 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -35,9 +35,24 @@ onMount(async () => { - const res = await fetch('/api/dienststellen'); - dienststellen = await res.json(); + const resDienstelle = await fetch('/api/dienststellen'); + dienststellen = await resDienstelle.json(); + + const resZeitraeume = await fetch('/api/zeitraeume'); + zeitraeume = await resZeitraeume.json(); }); + interface Zeitraum { + id: number; + bezeichnung: string; + startDatum: string; + endDatum: string; + } + let zeitraeume: Zeitraum[] = []; + //let neuerBezeichnung = ''; + //let neuerstartDatum = ''; + //let neuerendDatum = ''; + let fehlermeldung = ''; + let bearbeiteId: number | null = null; function resetForm() { anrede = ''; @@ -180,7 +195,15 @@ - + + +