diff --git a/bun.lock b/bun.lock index 7f7da9ef..c53622c4 100644 --- a/bun.lock +++ b/bun.lock @@ -9,6 +9,7 @@ "@astrojs/svelte": "^2.2.0", "@astrojs/tailwind": "^3.1.3", "@aws-sdk/client-s3": "^3.758.0", + "@highlight-run/node": "^3.12.0", "@ibcornelsen/ui": "^0.0.2", "@mollie/api-client": "^4.1.0", "@pdfme/common": "^5.2.16", @@ -25,6 +26,7 @@ "express": "^4.21.2", "flag-icons": "^6.15.0", "fontkit": "^2.0.4", + "highlight.run": "^9.14.0", "is-base64": "^1.1.0", "js-cookie": "^3.0.5", "js-interpolate": "^1.3.2", @@ -346,6 +348,8 @@ "@hapi/bourne": ["@hapi/bourne@3.0.0", "", {}, "sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w=="], + "@highlight-run/node": ["@highlight-run/node@3.12.0", "", { "dependencies": { "@prisma/instrumentation": ">=5.0.0", "require-in-the-middle": "^7.4.0" } }, "sha512-wmvj8rf+p/JbUTfgsbhc5srP87sfZNofHTlXlaLI5JT8XpfRgBHXgSHWOw79l8dgncqceUkct1cN+liR5LdnKg=="], + "@humanwhocodes/config-array": ["@humanwhocodes/config-array@0.9.5", "", { "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", "minimatch": "^3.0.4" } }, "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw=="], "@humanwhocodes/object-schema": ["@humanwhocodes/object-schema@1.2.1", "", {}, "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="], @@ -416,6 +420,10 @@ "@opentelemetry/api": ["@opentelemetry/api@1.4.1", "", {}, "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA=="], + "@opentelemetry/api-logs": ["@opentelemetry/api-logs@0.57.2", "", { "dependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-uIX52NnTM0iBh84MShlpouI7UKqkZ7MrUszTmaypHBu4r7NofznSnQRfJ+uUeDtQDj6w8eFGg5KBLDAwAPz1+A=="], + + "@opentelemetry/instrumentation": ["@opentelemetry/instrumentation@0.57.2", "", { "dependencies": { "@opentelemetry/api-logs": "0.57.2", "@types/shimmer": "^1.2.0", "import-in-the-middle": "^1.8.1", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2", "shimmer": "^1.2.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-BdBGhQBh8IjZ2oIIX6F2/Q3LKm/FDDKi6ccYKcBTeilh6SNdNKveDOLk73BkSJjQLJk6qe4Yh+hHw1UPhCDdrg=="], + "@oslojs/encoding": ["@oslojs/encoding@1.1.0", "", {}, "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ=="], "@oven/bun-darwin-aarch64": ["@oven/bun-darwin-aarch64@1.2.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ggZfdpgUJ/OiWrfcfTgHeSTHcec5HAjkGrZHL9FJ/R60sydRKPYHgAgexdIoJAGfsCVAL+x7y8NSTRIAX8J4Ng=="], @@ -500,6 +508,8 @@ "@prisma/get-platform": ["@prisma/get-platform@6.4.1", "", { "dependencies": { "@prisma/debug": "6.4.1" } }, "sha512-gXqZaDI5scDkBF8oza7fOD3Q3QMD0e0rBynlzDDZdTWbWmzjuW58PRZtj+jkvKje2+ZigCWkH8SsWZAsH6q1Yw=="], + "@prisma/instrumentation": ["@prisma/instrumentation@6.5.0", "", { "dependencies": { "@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0" }, "peerDependencies": { "@opentelemetry/api": "^1.8" } }, "sha512-morJDtFRoAp5d/KENEm+K6Y3PQcn5bCvpJ5a9y3V3DNMrNy/ZSn2zulPGj+ld+Xj2UYVoaMJ8DpBX/o6iF6OiA=="], + "@prisma/internals": ["@prisma/internals@5.0.0", "", { "dependencies": { "@antfu/ni": "0.21.4", "@opentelemetry/api": "1.4.1", "@prisma/debug": "5.0.0", "@prisma/engines": "5.0.0", "@prisma/fetch-engine": "5.0.0", "@prisma/generator-helper": "5.0.0", "@prisma/get-platform": "5.0.0", "@prisma/prisma-schema-wasm": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584", "archiver": "5.3.1", "arg": "5.0.2", "checkpoint-client": "1.1.24", "cli-truncate": "2.1.0", "dotenv": "16.0.3", "escape-string-regexp": "4.0.0", "execa": "5.1.1", "find-up": "5.0.0", "fp-ts": "2.16.0", "fs-extra": "11.1.1", "fs-jetpack": "5.1.0", "global-dirs": "3.0.1", "globby": "11.1.0", "indent-string": "4.0.0", "is-windows": "1.0.2", "is-wsl": "2.2.0", "kleur": "4.1.5", "new-github-issue-url": "0.2.1", "node-fetch": "2.6.12", "npm-packlist": "5.1.3", "open": "7.4.2", "p-map": "4.0.0", "prompts": "2.4.2", "read-pkg-up": "7.0.1", "replace-string": "3.1.0", "resolve": "1.22.2", "string-width": "4.2.3", "strip-ansi": "6.0.1", "strip-indent": "3.0.0", "temp-dir": "2.0.0", "temp-write": "4.0.0", "tempy": "1.0.1", "terminal-link": "2.1.1", "tmp": "0.2.1", "ts-pattern": "4.3.0" } }, "sha512-VGWyFk6QlSBXT8z65Alq5F3o9E8IiTtaBoa3rmKkGpZjUk85kJy3jZz4xkRv53TaeghGE5rWfwkfak26KtY5yQ=="], "@prisma/prisma-schema-wasm": ["@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584", "", {}, "sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA=="], @@ -792,6 +802,8 @@ "@types/serve-static": ["@types/serve-static@1.15.7", "", { "dependencies": { "@types/http-errors": "*", "@types/node": "*", "@types/send": "*" } }, "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw=="], + "@types/shimmer": ["@types/shimmer@1.2.0", "", {}, "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg=="], + "@types/siema": ["@types/siema@1.4.11", "", {}, "sha512-bPazsNVnMryrzZx2HiAeDXEpgaO98ToQk0cYJ/7yomLlVNHsn4IYPrLoQ50tQt11FGvkkNoepRyKcTNUhqjj+g=="], "@types/sinonjs__fake-timers": ["@types/sinonjs__fake-timers@8.1.1", "", {}, "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g=="], @@ -834,6 +846,8 @@ "acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], + "acorn-import-attributes": ["acorn-import-attributes@1.9.5", "", { "peerDependencies": { "acorn": "^8" } }, "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ=="], + "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], "add-dom-event-listener": ["add-dom-event-listener@1.1.0", "", { "dependencies": { "object-assign": "4.x" } }, "sha512-WCxx1ixHT0GQU9hb0KI/mhgRQhnU+U3GvwY6ZvVjYq8rsihIGoaIOUbY0yMPBxLH5MDtr0kz3fisWGNcbWW7Jw=="], @@ -1012,6 +1026,8 @@ "ci-info": ["ci-info@4.1.0", "", {}, "sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A=="], + "cjs-module-lexer": ["cjs-module-lexer@1.4.3", "", {}, "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q=="], + "classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="], "clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], @@ -1470,6 +1486,8 @@ "hexoid": ["hexoid@2.0.0", "", {}, "sha512-qlspKUK7IlSQv2o+5I7yhUd7TxlOG2Vr5LTa3ve2XSNVKAL/n/u/7KLvKmFNimomDIKvZFXWHv0T12mv7rT8Aw=="], + "highlight.run": ["highlight.run@9.14.0", "", {}, "sha512-ZR+ZLHlVU8lXqsuto0ZEMAOuvptaTBBf1jradnKDIn9OfAXupcYFbkASDlbsZtyBh2SYJSK50xwrucXujhksRg=="], + "hosted-git-info": ["hosted-git-info@2.8.9", "", {}, "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="], "hotkeys-js": ["hotkeys-js@3.13.9", "", {}, "sha512-3TRCj9u9KUH6cKo25w4KIdBfdBfNRjfUwrljCLDC2XhmPDG0SjAZFcFZekpUZFmXzfYoGhFDcdx2gX/vUVtztQ=="], @@ -1504,6 +1522,8 @@ "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], + "import-in-the-middle": ["import-in-the-middle@1.13.1", "", { "dependencies": { "acorn": "^8.14.0", "acorn-import-attributes": "^1.9.5", "cjs-module-lexer": "^1.2.2", "module-details-from-path": "^1.0.3" } }, "sha512-k2V9wNm9B+ysuelDTHjI9d5KPc4l8zAZTGqj+pcynvWkypZd857ryzN8jNC7Pg2YZXNMJcHRPpaDyCBbNyVRpA=="], + "import-meta-resolve": ["import-meta-resolve@4.1.0", "", {}, "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw=="], "imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="], @@ -1862,6 +1882,8 @@ "mkdirp": ["mkdirp@1.0.4", "", { "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="], + "module-details-from-path": ["module-details-from-path@1.0.3", "", {}, "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="], + "moment": ["moment@2.30.1", "", {}, "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how=="], "moment-timezone": ["moment-timezone@0.5.47", "", { "dependencies": { "moment": "^2.29.4" } }, "sha512-UbNt/JAWS0m/NJOebR0QMRHBk0hu03r5dx9GK8Cs0AS3I81yDcOc9k+DytPItgVvBP7J6Mf6U2n3BPAacAV9oA=="], @@ -2246,6 +2268,8 @@ "request-progress": ["request-progress@3.0.0", "", { "dependencies": { "throttleit": "^1.0.0" } }, "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg=="], + "require-in-the-middle": ["require-in-the-middle@7.5.2", "", { "dependencies": { "debug": "^4.3.5", "module-details-from-path": "^1.0.3", "resolve": "^1.22.8" } }, "sha512-gAZ+kLqBdHarXB64XpAe2VCjB7rIRv+mU8tfRWziHRJ5umKsIHN2tLLv6EtMw7WCdP19S0ERVMldNvxYCHnhSQ=="], + "resize-observer-polyfill": ["resize-observer-polyfill@1.5.1", "", {}, "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="], "resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], @@ -2326,6 +2350,8 @@ "shiki": ["shiki@1.29.2", "", { "dependencies": { "@shikijs/core": "1.29.2", "@shikijs/engine-javascript": "1.29.2", "@shikijs/engine-oniguruma": "1.29.2", "@shikijs/langs": "1.29.2", "@shikijs/themes": "1.29.2", "@shikijs/types": "1.29.2", "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } }, "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg=="], + "shimmer": ["shimmer@1.2.1", "", {}, "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw=="], + "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="], "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="], diff --git a/cypress.config.ts b/cypress.config.ts index d39cc165..e6e1c1a1 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "cypress"; import dsv from "@rollup/plugin-dsv" - +import { prisma } from "./src/lib/server/prisma" import { fileURLToPath } from "url"; import vitePreprocessor from "cypress-vite"; @@ -9,7 +9,7 @@ export default defineConfig({ baseUrl: "http://localhost:3000", viewportHeight: 900, viewportWidth: 1660, - supportFile: false, + supportFile: fileURLToPath(new URL("./src/cypress/support/commands.ts", import.meta.url)), specPattern: "./src/cypress/e2e/**/*.{ts,js}", setupNodeEvents(on, config) { on("file:preprocessor", vitePreprocessor({ @@ -18,6 +18,7 @@ export default defineConfig({ }, resolve: { alias: { + ".prisma/client/index-browser": fileURLToPath(new URL("./node_modules/.prisma/client/index-browser.js", import.meta.url)), "#": fileURLToPath(new URL("./src", import.meta.url)), "#components": fileURLToPath(new URL("./src/components", import.meta.url)), "#lib": fileURLToPath(new URL("./src/lib", import.meta.url)) @@ -31,6 +32,11 @@ export default defineConfig({ }, plugins: [dsv()] })) + on("task", { + async verbrauchsausweisWohnen(query) { + return await prisma.verbrauchsausweisWohnen.findFirst(query) + } + }) }, }, component: { diff --git a/package.json b/package.json index f5206d3b..1e55d508 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@astrojs/svelte": "^2.2.0", "@astrojs/tailwind": "^3.1.3", "@aws-sdk/client-s3": "^3.758.0", + "@highlight-run/node": "^3.12.0", "@ibcornelsen/ui": "^0.0.2", "@mollie/api-client": "^4.1.0", "@pdfme/common": "^5.2.16", @@ -39,6 +40,7 @@ "express": "^4.21.2", "flag-icons": "^6.15.0", "fontkit": "^2.0.4", + "highlight.run": "^9.14.0", "is-base64": "^1.1.0", "js-cookie": "^3.0.5", "js-interpolate": "^1.3.2", diff --git a/prisma/migrations/20250324191736_ausweistyp/migration.sql b/prisma/migrations/20250324191736_ausweistyp/migration.sql new file mode 100644 index 00000000..3e29f2ed --- /dev/null +++ b/prisma/migrations/20250324191736_ausweistyp/migration.sql @@ -0,0 +1,57 @@ +/* + Warnings: + + - You are about to drop the column `ausweistyp` on the `Rechnung` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Anteilshaber" ALTER COLUMN "uid" SET DEFAULT 'ant-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Aufnahme" ALTER COLUMN "uid" SET DEFAULT 'auf-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "BedarfsausweisGewerbe" ALTER COLUMN "uid" SET DEFAULT 'bag-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "BedarfsausweisWohnen" ADD COLUMN "ausweistyp" "AusweisTyp" NOT NULL DEFAULT 'Standard', +ALTER COLUMN "uid" SET DEFAULT 'baw-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Bild" ALTER COLUMN "uid" SET DEFAULT 'img-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Event" ALTER COLUMN "uid" SET DEFAULT 'evt-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "GEGEinpreisung" ALTER COLUMN "uid" SET DEFAULT 'gge-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "GEGNachweisGewerbe" ALTER COLUMN "uid" SET DEFAULT 'gng-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "GEGNachweisWohnen" ALTER COLUMN "uid" SET DEFAULT 'gnw-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Objekt" ALTER COLUMN "uid" SET DEFAULT 'obj-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Rechnung" DROP COLUMN "ausweistyp", +ALTER COLUMN "uid" SET DEFAULT 'inv-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Tickets" ALTER COLUMN "uid" SET DEFAULT 'tkt-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "Unterlage" ALTER COLUMN "uid" SET DEFAULT 'pln-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "VerbrauchsausweisGewerbe" ADD COLUMN "ausweistyp" "AusweisTyp" NOT NULL DEFAULT 'Standard', +ALTER COLUMN "uid" SET DEFAULT 'vag-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "VerbrauchsausweisWohnen" ADD COLUMN "ausweistyp" "AusweisTyp" NOT NULL DEFAULT 'Standard', +ALTER COLUMN "uid" SET DEFAULT 'vaw-' || gen_random_uuid(); + +-- AlterTable +ALTER TABLE "benutzer" ALTER COLUMN "uid" SET DEFAULT 'usr-' || gen_random_uuid(); diff --git a/prisma/migrations/20250324210605_id/migration.sql b/prisma/migrations/20250324210605_id/migration.sql new file mode 100644 index 00000000..e4be4967 --- /dev/null +++ b/prisma/migrations/20250324210605_id/migration.sql @@ -0,0 +1,573 @@ +/* + Warnings: + + - The primary key for the `Anteilshaber` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Anteilshaber` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Anteilshaber` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `ApiRequests` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to alter the column `id` on the `ApiRequests` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Aufnahme` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Aufnahme` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Aufnahme` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `BedarfsausweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `BedarfsausweisGewerbe` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `BedarfsausweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `BedarfsausweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `BedarfsausweisWohnen` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `BedarfsausweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Bild` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to alter the column `id` on the `Bild` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Event` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Event` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Event` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `GEGEinpreisung` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `GEGEinpreisung` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `GEGEinpreisung` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `GEGNachweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `GEGNachweisGewerbe` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `GEGNachweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `GEGNachweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `GEGNachweisWohnen` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `GEGNachweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Objekt` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Objekt` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Objekt` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Rechnung` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Rechnung` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Rechnung` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Tickets` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Tickets` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Tickets` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `Unterlage` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `Unterlage` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `Unterlage` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `VerbrauchsausweisGewerbe` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `VerbrauchsausweisGewerbe` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `VerbrauchsausweisGewerbe` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `VerbrauchsausweisWohnen` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `VerbrauchsausweisWohnen` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `VerbrauchsausweisWohnen` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - The primary key for the `benutzer` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `uid` on the `benutzer` table. All the data in the column will be lost. + - You are about to alter the column `id` on the `benutzer` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `VarChar(8)`. + - A unique constraint covering the columns `[id]` on the table `Anteilshaber` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `ApiRequests` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Aufnahme` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `BedarfsausweisGewerbe` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `BedarfsausweisWohnen` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Bild` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Event` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `GEGEinpreisung` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `GEGNachweisGewerbe` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `GEGNachweisWohnen` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Objekt` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Rechnung` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Tickets` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `Unterlage` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `VerbrauchsausweisGewerbe` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `VerbrauchsausweisWohnen` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[id]` on the table `benutzer` will be added. If there are existing duplicate values, this will fail. + +*/ +-- DropForeignKey +ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_objekt_id_fkey"; + +-- DropForeignKey +ALTER TABLE "ApiRequests" DROP CONSTRAINT "ApiRequests_user_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_objekt_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_geg_einpreisung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Bild" DROP CONSTRAINT "Bild_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Event" DROP CONSTRAINT "Event_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Event" DROP CONSTRAINT "Event_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGEinpreisung" DROP CONSTRAINT "GEGEinpreisung_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_geg_einpreisung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_geg_einpreisung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Objekt" DROP CONSTRAINT "Objekt_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Rechnung" DROP CONSTRAINT "Rechnung_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "RefreshTokens" DROP CONSTRAINT "RefreshTokens_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_bearbeiter_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "Unterlage" DROP CONSTRAINT "Unterlage_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_aufnahme_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_benutzer_id_fkey"; + +-- DropForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_rechnung_id_fkey"; + +-- DropForeignKey +ALTER TABLE "documenttemplates" DROP CONSTRAINT "benutzer_fk"; + +-- DropForeignKey +ALTER TABLE "tokens" DROP CONSTRAINT "fk_benutzer_tokens_user_id"; + +-- DropIndex +DROP INDEX "Anteilshaber_uid_key"; + +-- DropIndex +DROP INDEX "Aufnahme_uid_key"; + +-- DropIndex +DROP INDEX "BedarfsausweisGewerbe_uid_key"; + +-- DropIndex +DROP INDEX "BedarfsausweisWohnen_uid_key"; + +-- DropIndex +DROP INDEX "Event_uid_key"; + +-- DropIndex +DROP INDEX "GEGEinpreisung_uid_key"; + +-- DropIndex +DROP INDEX "GEGNachweisGewerbe_uid_key"; + +-- DropIndex +DROP INDEX "GEGNachweisWohnen_uid_key"; + +-- DropIndex +DROP INDEX "Objekt_uid_key"; + +-- DropIndex +DROP INDEX "Rechnung_uid_key"; + +-- DropIndex +DROP INDEX "Tickets_uid_key"; + +-- DropIndex +DROP INDEX "Unterlage_uid_key"; + +-- DropIndex +DROP INDEX "VerbrauchsausweisGewerbe_uid_key"; + +-- DropIndex +DROP INDEX "VerbrauchsausweisWohnen_uid_key"; + +-- DropIndex +DROP INDEX "benutzer_uid_key"; + +-- AlterTable +ALTER TABLE "Anteilshaber" DROP CONSTRAINT "Anteilshaber_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "objekt_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Anteilshaber_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Anteilshaber_id_seq"; + +-- AlterTable +ALTER TABLE "ApiRequests" DROP CONSTRAINT "ApiRequests_pkey", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "user_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "ApiRequests_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "ApiRequests_id_seq"; + +-- AlterTable +ALTER TABLE "Aufnahme" DROP CONSTRAINT "Aufnahme_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "objekt_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Aufnahme_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Aufnahme_id_seq"; + +-- AlterTable +ALTER TABLE "BedarfsausweisGewerbe" DROP CONSTRAINT "BedarfsausweisGewerbe_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "BedarfsausweisGewerbe_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "BedarfsausweisGewerbe_id_seq"; + +-- AlterTable +ALTER TABLE "BedarfsausweisWohnen" DROP CONSTRAINT "BedarfsausweisWohnen_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "BedarfsausweisWohnen_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "BedarfsausweisWohnen_id_seq"; + +-- AlterTable +ALTER TABLE "Bild" DROP CONSTRAINT "Bild_pkey", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "uid" SET DEFAULT 'img-' || gen_random_uuid(), +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Bild_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Bild_id_seq"; + +-- AlterTable +ALTER TABLE "Event" DROP CONSTRAINT "Event_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Event_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Event_id_seq"; + +-- AlterTable +ALTER TABLE "GEGEinpreisung" DROP CONSTRAINT "GEGEinpreisung_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "GEGEinpreisung_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "GEGEinpreisung_id_seq"; + +-- AlterTable +ALTER TABLE "GEGNachweisGewerbe" DROP CONSTRAINT "GEGNachweisGewerbe_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "GEGNachweisGewerbe_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "GEGNachweisGewerbe_id_seq"; + +-- AlterTable +ALTER TABLE "GEGNachweisWohnen" DROP CONSTRAINT "GEGNachweisWohnen_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "geg_einpreisung_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "GEGNachweisWohnen_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "GEGNachweisWohnen_id_seq"; + +-- AlterTable +ALTER TABLE "Objekt" DROP CONSTRAINT "Objekt_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Objekt_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Objekt_id_seq"; + +-- AlterTable +ALTER TABLE "Rechnung" DROP CONSTRAINT "Rechnung_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Rechnung_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Rechnung_id_seq"; + +-- AlterTable +ALTER TABLE "RefreshTokens" ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT; + +-- AlterTable +ALTER TABLE "Tickets" DROP CONSTRAINT "Tickets_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "bearbeiter_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Tickets_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Tickets_id_seq"; + +-- AlterTable +ALTER TABLE "Unterlage" DROP CONSTRAINT "Unterlage_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "Unterlage_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "Unterlage_id_seq"; + +-- AlterTable +ALTER TABLE "VerbrauchsausweisGewerbe" DROP CONSTRAINT "VerbrauchsausweisGewerbe_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "VerbrauchsausweisGewerbe_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "VerbrauchsausweisGewerbe_id_seq"; + +-- AlterTable +ALTER TABLE "VerbrauchsausweisWohnen" DROP CONSTRAINT "VerbrauchsausweisWohnen_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ALTER COLUMN "benutzer_id" SET DATA TYPE TEXT, +ALTER COLUMN "rechnung_id" SET DATA TYPE TEXT, +ALTER COLUMN "aufnahme_id" SET DATA TYPE TEXT, +ADD CONSTRAINT "VerbrauchsausweisWohnen_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "VerbrauchsausweisWohnen_id_seq"; + +-- AlterTable +ALTER TABLE "benutzer" DROP CONSTRAINT "benutzer_pkey", +DROP COLUMN "uid", +ALTER COLUMN "id" DROP DEFAULT, +ALTER COLUMN "id" SET DATA TYPE VARCHAR(8), +ADD CONSTRAINT "benutzer_pkey" PRIMARY KEY ("id"); +DROP SEQUENCE "benutzer_id_seq"; + +-- AlterTable +ALTER TABLE "documenttemplates" ALTER COLUMN "user_id" SET DATA TYPE TEXT; + +-- AlterTable +ALTER TABLE "tokens" ALTER COLUMN "user_id" SET DATA TYPE TEXT; + +-- CreateIndex +CREATE UNIQUE INDEX "Anteilshaber_id_key" ON "Anteilshaber"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "ApiRequests_id_key" ON "ApiRequests"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Aufnahme_id_key" ON "Aufnahme"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "BedarfsausweisGewerbe_id_key" ON "BedarfsausweisGewerbe"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "BedarfsausweisWohnen_id_key" ON "BedarfsausweisWohnen"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Bild_id_key" ON "Bild"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Event_id_key" ON "Event"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "GEGEinpreisung_id_key" ON "GEGEinpreisung"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "GEGNachweisGewerbe_id_key" ON "GEGNachweisGewerbe"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "GEGNachweisWohnen_id_key" ON "GEGNachweisWohnen"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Objekt_id_key" ON "Objekt"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Rechnung_id_key" ON "Rechnung"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Tickets_id_key" ON "Tickets"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "Unterlage_id_key" ON "Unterlage"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "VerbrauchsausweisGewerbe_id_key" ON "VerbrauchsausweisGewerbe"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "VerbrauchsausweisWohnen_id_key" ON "VerbrauchsausweisWohnen"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "benutzer_id_key" ON "benutzer"("id"); + +-- AddForeignKey +ALTER TABLE "Anteilshaber" ADD CONSTRAINT "Anteilshaber_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Anteilshaber" ADD CONSTRAINT "Anteilshaber_objekt_id_fkey" FOREIGN KEY ("objekt_id") REFERENCES "Objekt"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "ApiRequests" ADD CONSTRAINT "ApiRequests_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Aufnahme" ADD CONSTRAINT "Aufnahme_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Aufnahme" ADD CONSTRAINT "Aufnahme_objekt_id_fkey" FOREIGN KEY ("objekt_id") REFERENCES "Objekt"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisGewerbe" ADD CONSTRAINT "BedarfsausweisGewerbe_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "BedarfsausweisWohnen" ADD CONSTRAINT "BedarfsausweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Bild" ADD CONSTRAINT "Bild_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Event" ADD CONSTRAINT "Event_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Event" ADD CONSTRAINT "Event_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGEinpreisung" ADD CONSTRAINT "GEGEinpreisung_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisGewerbe" ADD CONSTRAINT "GEGNachweisGewerbe_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "GEGNachweisWohnen" ADD CONSTRAINT "GEGNachweisWohnen_geg_einpreisung_id_fkey" FOREIGN KEY ("geg_einpreisung_id") REFERENCES "GEGEinpreisung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "Objekt" ADD CONSTRAINT "Objekt_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Rechnung" ADD CONSTRAINT "Rechnung_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "RefreshTokens" ADD CONSTRAINT "RefreshTokens_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Tickets" ADD CONSTRAINT "Tickets_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Tickets" ADD CONSTRAINT "Tickets_bearbeiter_id_fkey" FOREIGN KEY ("bearbeiter_id") REFERENCES "benutzer"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Unterlage" ADD CONSTRAINT "Unterlage_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisGewerbe" ADD CONSTRAINT "VerbrauchsausweisGewerbe_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_rechnung_id_fkey" FOREIGN KEY ("rechnung_id") REFERENCES "Rechnung"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "VerbrauchsausweisWohnen" ADD CONSTRAINT "VerbrauchsausweisWohnen_aufnahme_id_fkey" FOREIGN KEY ("aufnahme_id") REFERENCES "Aufnahme"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- AddForeignKey +ALTER TABLE "documenttemplates" ADD CONSTRAINT "benutzer_fk" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "tokens" ADD CONSTRAINT "fk_benutzer_tokens_user_id" FOREIGN KEY ("user_id") REFERENCES "benutzer"("id") ON DELETE NO ACTION ON UPDATE NO ACTION; diff --git a/prisma/schema/Anteilshaber.prisma b/prisma/schema/Anteilshaber.prisma index c20e48bd..a3542975 100644 --- a/prisma/schema/Anteilshaber.prisma +++ b/prisma/schema/Anteilshaber.prisma @@ -1,11 +1,11 @@ model Anteilshaber { - id Int @id @default(autoincrement()) - benutzer_id Int + id String @id @unique @db.VarChar(8) rolle String? @db.VarChar privilegien BigInt? - uid String @unique @default(dbgenerated("'ant-' || gen_random_uuid()")) + + benutzer_id String benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - objekt_id Int + objekt_id String objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } \ No newline at end of file diff --git a/prisma/schema/ApiRequests.prisma b/prisma/schema/ApiRequests.prisma index c8c253cf..1f61860e 100644 --- a/prisma/schema/ApiRequests.prisma +++ b/prisma/schema/ApiRequests.prisma @@ -1,6 +1,6 @@ model ApiRequests { - id Int @id @default(autoincrement()) + id String @id @unique @db.VarChar(8) date DateTime @default(now()) @db.Timestamp(6) ip String @db.VarChar(50) method String @db.VarChar(10) @@ -9,6 +9,6 @@ model ApiRequests { responseTime Float responseSize Int userAgent String @db.VarChar(500) - user_id Int? + user_id String? user Benutzer? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/Aufnahme.prisma b/prisma/schema/Aufnahme.prisma index ba750f00..317d78c2 100644 --- a/prisma/schema/Aufnahme.prisma +++ b/prisma/schema/Aufnahme.prisma @@ -13,10 +13,8 @@ enum Lueftungskonzept { } model Aufnahme { - id Int @id @default(autoincrement()) - /// @zod.describe("UID der Gebäude Aufnahme") - uid String @unique @default(dbgenerated("'auf-' || gen_random_uuid()")) - benutzer_id Int? + id String @id @unique @db.VarChar(8) + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) /// @zod.describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen") ausweisart Ausweisart? @@ -142,7 +140,7 @@ model Aufnahme { geg_nachweise_gewerbe GEGNachweisGewerbe[] bedarfsausweise_gewerbe BedarfsausweisGewerbe[] - objekt_id Int + objekt_id String objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/BedarfsausweisGewerbe.prisma b/prisma/schema/BedarfsausweisGewerbe.prisma index f904331e..d0c97158 100644 --- a/prisma/schema/BedarfsausweisGewerbe.prisma +++ b/prisma/schema/BedarfsausweisGewerbe.prisma @@ -1,6 +1,5 @@ model BedarfsausweisGewerbe { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'bag-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) /// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf") ausstellgrund Ausstellgrund? @@ -27,13 +26,13 @@ model BedarfsausweisGewerbe { klimatisierung Boolean? @default(false) /// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört") - benutzer_id Int? + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - geg_einpreisung_id Int? @unique + geg_einpreisung_id String? @unique geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } \ No newline at end of file diff --git a/prisma/schema/BedarfsausweisWohnen.prisma b/prisma/schema/BedarfsausweisWohnen.prisma index 558638eb..e2ce4f2a 100644 --- a/prisma/schema/BedarfsausweisWohnen.prisma +++ b/prisma/schema/BedarfsausweisWohnen.prisma @@ -1,9 +1,8 @@ model BedarfsausweisWohnen { - id Int @id @default(autoincrement()) + id String @id @unique @db.VarChar(8) alte_ausweis_id Int? - uid String @unique @default(dbgenerated("'baw-' || gen_random_uuid()")) - benutzer_id Int? + benutzer_id String? ausstellgrund Ausstellgrund? registriernummer String? @db.VarChar @@ -79,13 +78,14 @@ model BedarfsausweisWohnen { created_at DateTime @default(now()) updated_at DateTime @updatedAt + ausweistyp AusweisTyp @default(Standard) benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) /// @zod.describe("ID der korrespondierenden Gebäudeaufnahme") - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/Benutzer.prisma b/prisma/schema/Benutzer.prisma index 2ed48f96..1ea65d80 100644 --- a/prisma/schema/Benutzer.prisma +++ b/prisma/schema/Benutzer.prisma @@ -5,8 +5,7 @@ enum BenutzerRolle { } model Benutzer { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'usr-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) name String? @db.VarChar(50) vorname String? @db.VarChar(50) email String @unique(map: "benutzer_email_idx") @db.VarChar(255) diff --git a/prisma/schema/Bild.prisma b/prisma/schema/Bild.prisma index 3c238907..284f380d 100644 --- a/prisma/schema/Bild.prisma +++ b/prisma/schema/Bild.prisma @@ -8,11 +8,10 @@ enum BilderKategorie { } model Bild { - id Int @id @default(autoincrement()) + id String @id @unique @db.VarChar(8) kategorie BilderKategorie - uid String @unique @default(dbgenerated("'img-' || gen_random_uuid()")) name String - aufnahme_id Int? + aufnahme_id String? aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } \ No newline at end of file diff --git a/prisma/schema/Event.prisma b/prisma/schema/Event.prisma index 2203363d..f6ae0866 100644 --- a/prisma/schema/Event.prisma +++ b/prisma/schema/Event.prisma @@ -3,8 +3,7 @@ // Hier werden beispielsweise Events wie "Nachricht Verschickt" gespeichert. // Diese Events werden dann in der Admin-Oberfläche angezeigt. model Event { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'evt-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) date DateTime @default(now()) @db.Timestamp(6) title String @db.VarChar(255) @@ -12,9 +11,9 @@ model Event { // Verlinkung des Gebäudes - aufnahme_id Int + aufnahme_id String aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) // Verlinkung des Benutzers - benutzer_id Int? + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/GEGEinpreisung.prisma b/prisma/schema/GEGEinpreisung.prisma index 14ef101a..a8c8ef58 100644 --- a/prisma/schema/GEGEinpreisung.prisma +++ b/prisma/schema/GEGEinpreisung.prisma @@ -6,8 +6,7 @@ enum Einpreisungsstatus { } model GEGEinpreisung { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'gge-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) empfaenger String? @db.VarChar strasse String? @db.VarChar @@ -31,6 +30,6 @@ model GEGEinpreisung { bedarfsausweis_gewerbe BedarfsausweisGewerbe? /// @zod.describe("Die ID des Benutzers, der diese Einpreisung bekommt.") - benutzer_id Int? + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } \ No newline at end of file diff --git a/prisma/schema/GEGNachweisGewerbe.prisma b/prisma/schema/GEGNachweisGewerbe.prisma index 19a2d401..b7f39cca 100644 --- a/prisma/schema/GEGNachweisGewerbe.prisma +++ b/prisma/schema/GEGNachweisGewerbe.prisma @@ -1,6 +1,5 @@ model GEGNachweisGewerbe { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'gng-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) /// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf") ausstellgrund Ausstellgrund? @@ -18,13 +17,13 @@ model GEGNachweisGewerbe { beschreibung String? @db.Text /// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört") - benutzer_id Int? + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - geg_einpreisung_id Int? @unique + geg_einpreisung_id String? @unique geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/GEGNachweisWohnen.prisma b/prisma/schema/GEGNachweisWohnen.prisma index ac10d2d9..c4b747b0 100644 --- a/prisma/schema/GEGNachweisWohnen.prisma +++ b/prisma/schema/GEGNachweisWohnen.prisma @@ -1,6 +1,5 @@ model GEGNachweisWohnen { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'gnw-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) /// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf") ausstellgrund Ausstellgrund? @@ -18,13 +17,13 @@ model GEGNachweisWohnen { beschreibung String? @db.Text /// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört") - benutzer_id Int? + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - geg_einpreisung_id Int? @unique + geg_einpreisung_id String? @unique geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/Objekt.prisma b/prisma/schema/Objekt.prisma index bf1acda9..3f0fb4af 100644 --- a/prisma/schema/Objekt.prisma +++ b/prisma/schema/Objekt.prisma @@ -1,7 +1,5 @@ model Objekt { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'obj-' || gen_random_uuid()")) - benutzer_id Int? + id String @id @unique @db.VarChar(8) latitude Float? longitude Float? @@ -15,6 +13,7 @@ model Objekt { erstellungsdatum DateTime? @default(now()) + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id]) aufnahmen Aufnahme[] anteilshaber Anteilshaber[] diff --git a/prisma/schema/Rechnung.prisma b/prisma/schema/Rechnung.prisma index b2b21c3a..a517b851 100644 --- a/prisma/schema/Rechnung.prisma +++ b/prisma/schema/Rechnung.prisma @@ -24,10 +24,8 @@ enum AusweisTyp { } model Rechnung { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'inv-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) - benutzer_id Int empfaenger String? @db.VarChar strasse String? @db.VarChar plz String? @db.VarChar @@ -46,13 +44,13 @@ model Rechnung { bezahlmethode Bezahlmethoden status Rechnungsstatus services Service[] - ausweistyp AusweisTyp @default(Standard) betrag Float erstellt_am DateTime @default(now()) bezahlt_am DateTime? storniert_am DateTime? transaktions_referenz String? @unique @db.VarChar + benutzer_id String benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) verbrauchsausweis_wohnen VerbrauchsausweisWohnen? diff --git a/prisma/schema/RefreshTokens.prisma b/prisma/schema/RefreshTokens.prisma index f5292663..4c2003b0 100644 --- a/prisma/schema/RefreshTokens.prisma +++ b/prisma/schema/RefreshTokens.prisma @@ -1,7 +1,6 @@ model RefreshTokens { id Int @id @default(autoincrement()) - benutzer_id Int token String @unique // Wir nehmen die IP Adresse des Clients mit auf. // Falls sich die IP Adresse eines Refresh Token Owners ändert, können wir diesen einfach invalidieren. @@ -9,5 +8,6 @@ model RefreshTokens { expiry DateTime // Relationen + benutzer_id String user Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: Cascade) } \ No newline at end of file diff --git a/prisma/schema/Tickets.prisma b/prisma/schema/Tickets.prisma index 95210fef..f13213e6 100644 --- a/prisma/schema/Tickets.prisma +++ b/prisma/schema/Tickets.prisma @@ -8,9 +8,7 @@ enum TicketStatus { } model Tickets { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'tkt-' || gen_random_uuid()")) - benutzer_id Int? + id String @id @unique @db.VarChar(8) created_at DateTime @default(now()) updated_at DateTime? @updatedAt deleted_at DateTime? @@ -21,10 +19,11 @@ model Tickets { metadata Json? email String - bearbeiter_id Int? + bearbeiter_id String? prioritaet Int? @default(0) // Relationen + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], name: "ErstellteTickets") bearbeiter Benutzer? @relation(fields: [bearbeiter_id], references: [id], name: "BearbeiteteTickets") } diff --git a/prisma/schema/Unterlage.prisma b/prisma/schema/Unterlage.prisma index 64dce49f..af8cb225 100644 --- a/prisma/schema/Unterlage.prisma +++ b/prisma/schema/Unterlage.prisma @@ -5,12 +5,11 @@ enum UnterlagenKategorie { } model Unterlage { - id Int @id @default(autoincrement()) - uid String @unique @default(dbgenerated("'pln-' || gen_random_uuid()")) + id String @id @unique @db.VarChar(8) name String? kategorie String? mime String? - aufnahme_id Int? + aufnahme_id String? aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } \ No newline at end of file diff --git a/prisma/schema/VerbrauchsausweisGewerbe.prisma b/prisma/schema/VerbrauchsausweisGewerbe.prisma index 46973729..c827a1e7 100644 --- a/prisma/schema/VerbrauchsausweisGewerbe.prisma +++ b/prisma/schema/VerbrauchsausweisGewerbe.prisma @@ -1,9 +1,7 @@ model VerbrauchsausweisGewerbe { - id Int @id @default(autoincrement()) + id String @id @unique @db.VarChar(8) alte_ausweis_id Int? - uid String @unique @default(dbgenerated("'vag-' || gen_random_uuid()")) - benutzer_id Int? ausstellgrund Ausstellgrund? registriernummer String? @db.VarChar zusaetzliche_heizquelle Boolean? @@ -66,13 +64,15 @@ model VerbrauchsausweisGewerbe { created_at DateTime @default(now()) updated_at DateTime @updatedAt + ausweistyp AusweisTyp @default(Standard) + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) /// @zod.describe("ID der korrespondierenden Gebäudeaufnahme") - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/VerbrauchsausweisWohnen.prisma b/prisma/schema/VerbrauchsausweisWohnen.prisma index 2dec2998..a19e0e18 100644 --- a/prisma/schema/VerbrauchsausweisWohnen.prisma +++ b/prisma/schema/VerbrauchsausweisWohnen.prisma @@ -1,11 +1,8 @@ model VerbrauchsausweisWohnen { - id Int @id @default(autoincrement()) + /// @zod.describe("ID des Ausweises") + id String @id @unique @db.VarChar(8) alte_ausweis_id Int? - /// @zod.describe("UID des Ausweises") - uid String @unique @default(dbgenerated("'vaw-' || gen_random_uuid()")) - /// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört") - benutzer_id Int? /// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf") ausstellgrund Ausstellgrund? /// @zod.describe("Die Registriernummer des Ausweises") @@ -67,15 +64,19 @@ model VerbrauchsausweisWohnen { /// @zod.describe("Ob bei der Anfrage der Registriernummer eine Kontrolldatei angefragt wurde") kontrolldatei_angefragt Boolean? @default(false) + ausweistyp AusweisTyp @default(Standard) + created_at DateTime @default(now()) updated_at DateTime @updatedAt + /// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört") + benutzer_id String? benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - rechnung_id Int? @unique + rechnung_id String? @unique rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction) /// @zod.describe("ID der korrespondierenden Gebäudeaufnahme") - aufnahme_id Int @unique + aufnahme_id String @unique aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction) } diff --git a/prisma/schema/documenttemplates.prisma b/prisma/schema/documenttemplates.prisma index 6d57d88d..edda24d8 100644 --- a/prisma/schema/documenttemplates.prisma +++ b/prisma/schema/documenttemplates.prisma @@ -4,7 +4,7 @@ model documenttemplates { name String @db.VarChar(100) shortdescription String @db.VarChar(100) longdescription String @db.VarChar(5000) - user_id Int + user_id String is_private Boolean @default(true) documenttype Int filename String @db.VarChar(100) diff --git a/prisma/schema/tokens.prisma b/prisma/schema/tokens.prisma index 27a93f13..2f287068 100644 --- a/prisma/schema/tokens.prisma +++ b/prisma/schema/tokens.prisma @@ -2,7 +2,7 @@ model tokens { id Int @id(map: "PK_TOKENS") @default(autoincrement()) token String @db.VarChar(36) - user_id Int + user_id String date_created DateTime @default(now()) @db.Timestamp(6) last_used DateTime @default(now()) @db.Timestamp(6) times_used Int @default(0) diff --git a/prisma/seed.ts b/prisma/seed.ts index 9e7b6d05..b368b03d 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -93,6 +93,7 @@ await prisma.benutzer.create({ vorname: "Admin", adresse: "Adminstraße 1", plz: "12345", + id: "USADMIN1" }, }); @@ -106,6 +107,7 @@ await prisma.benutzer.create({ vorname: "User", adresse: "Userstraße 1", plz: "12345", + id: "USUSER01" }, }); diff --git a/server.ts b/server.ts index 98f9fcb8..1fba8129 100644 --- a/server.ts +++ b/server.ts @@ -1,7 +1,21 @@ import express from 'express'; +import { H, Handlers } from '@highlight-run/node' // @ts-ignore import { handler as ssrHandler } from './dist/server/entry.mjs'; +const highlightConfig = { + projectID: '1jdkoe52', + serviceName: "online-energieausweis", + serviceVersion: "git-sha", + environment: "production", + backendUrl: "http://212.227.61.149:3000/public", + networkRecording: { + enabled: true, + recordHeadersAndBody: true, + }, +} + +H.init(highlightConfig) const app = express(); const base = '/'; @@ -9,6 +23,8 @@ app.use(base, express.static('dist/client/')); app.use(ssrHandler); app.use(express.json({ limit: "50mb" })) app.use(express.urlencoded({ limit: "50mb" })) +app.use(Handlers.middleware(highlightConfig)) +app.use(Handlers.errorHandler(highlightConfig)) app.listen(3000, function() { console.log('Server started on http://localhost:3000'); diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts index 11b12809..af572bf4 100644 --- a/src/astro-typesafe-api-caller.ts +++ b/src/astro-typesafe-api-caller.ts @@ -5,10 +5,6 @@ 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"), - "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"), "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"), @@ -16,30 +12,34 @@ 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"), + "ausweise": await import("../src/pages/api/ausweise/index.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"), "bedarfsausweis-gewerbe/[uid]": await import("../src/pages/api/bedarfsausweis-gewerbe/[uid].ts"), "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"), - "ausweise": await import("../src/pages/api/ausweise/index.ts"), - "bedarfsausweis-wohnen/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].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/[uid]": await import("../src/pages/api/bilder/[uid].ts"), + "bilder/[id]": await import("../src/pages/api/bilder/[id].ts"), "geg-nachweis-gewerbe/[uid]": await import("../src/pages/api/geg-nachweis-gewerbe/[uid].ts"), "geg-nachweis-gewerbe": await import("../src/pages/api/geg-nachweis-gewerbe/index.ts"), "geg-nachweis-wohnen/[uid]": await import("../src/pages/api/geg-nachweis-wohnen/[uid].ts"), "geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"), "objekt": await import("../src/pages/api/objekt/index.ts"), - "rechnung/[uid]": await import("../src/pages/api/rechnung/[uid].ts"), + "rechnung/[id]": await import("../src/pages/api/rechnung/[id].ts"), "rechnung/anfordern": await import("../src/pages/api/rechnung/anfordern.ts"), "rechnung": await import("../src/pages/api/rechnung/index.ts"), "ticket": await import("../src/pages/api/ticket/index.ts"), "user": await import("../src/pages/api/user/index.ts"), "user/self": await import("../src/pages/api/user/self.ts"), - "verbrauchsausweis-wohnen/[uid]": await import("../src/pages/api/verbrauchsausweis-wohnen/[uid].ts"), - "verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"), - "verbrauchsausweis-gewerbe/[uid]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[uid].ts"), + "verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"), "verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"), + "verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"), + "verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"), "webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"), - "aufnahme/[uid]/bilder": await import("../src/pages/api/aufnahme/[uid]/bilder.ts"), - "aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid]/index.ts"), - "aufnahme/[uid]/unterlagen": await import("../src/pages/api/aufnahme/[uid]/unterlagen.ts"), - "objekt/[uid]": await import("../src/pages/api/objekt/[uid]/index.ts"), + "aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.ts"), + "aufnahme/[id]": await import("../src/pages/api/aufnahme/[id]/index.ts"), + "aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"), + "objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"), }) \ No newline at end of file diff --git a/src/client/lib/ausweisSpeichern.ts b/src/client/lib/ausweisSpeichern.ts index c8c2f168..741381ee 100644 --- a/src/client/lib/ausweisSpeichern.ts +++ b/src/client/lib/ausweisSpeichern.ts @@ -3,7 +3,7 @@ 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, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; +import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; import { Enums } from "#lib/client/prisma.js"; export async function ausweisSpeichern( @@ -13,8 +13,8 @@ export async function ausweisSpeichern( bilder: BildClient[], ausweisart: Enums.Ausweisart ) { - if (objekt.uid) { - await api.objekt._uid.PATCH.fetch({ + if (objekt.id) { + await api.objekt._id.PATCH.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -22,14 +22,14 @@ export async function ausweisSpeichern( plz: objekt.plz }, { params: { - uid: objekt.uid + id: objekt.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.objekt.PUT.fetch({ + const { id } = await api.objekt.PUT.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -41,16 +41,16 @@ export async function ausweisSpeichern( } }) - objekt.uid = uid; + objekt.id = id; } - if (aufnahme.uid) { - await api.aufnahme._uid.PATCH.fetch({ + if (aufnahme.id) { + await api.aufnahme._id.PATCH.fetch({ baujahr_gebaeude: aufnahme.baujahr_gebaeude, baujahr_heizung: aufnahme.baujahr_heizung, - baujahr_klima: aufnahme.baujahr_klima, + baujahr_klima: aufnahme.baujahr_klima || [], alternative_heizung: aufnahme.alternative_heizung, alternative_kuehlung: aufnahme.alternative_kuehlung, alternative_lueftung: aufnahme.alternative_lueftung, @@ -102,14 +102,14 @@ export async function ausweisSpeichern( zirkulation: aufnahme.zirkulation }, { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.aufnahme.PUT.fetch({ + const { id } = await api.aufnahme.PUT.fetch({ aufnahme: { baujahr_gebaeude: aufnahme.baujahr_gebaeude, baujahr_heizung: aufnahme.baujahr_heizung, @@ -165,56 +165,56 @@ export async function ausweisSpeichern( zentralheizung: aufnahme.zentralheizung, zirkulation: aufnahme.zirkulation }, - uid_objekt: objekt.uid + objekt_id: objekt.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - aufnahme.uid = uid + aufnahme.id = id } let patchRoute: any; let putRoute: any; if (ausweisart == Enums.Ausweisart.VerbrauchsausweisWohnen) { - patchRoute = api["verbrauchsausweis-wohnen"]._uid.PATCH + patchRoute = api["verbrauchsausweis-wohnen"]._id.PATCH putRoute = api["verbrauchsausweis-wohnen"].PUT } else if (ausweisart == Enums.Ausweisart.VerbrauchsausweisGewerbe) { - patchRoute = api["verbrauchsausweis-gewerbe"]._uid.PATCH + patchRoute = api["verbrauchsausweis-gewerbe"]._id.PATCH putRoute = api["verbrauchsausweis-gewerbe"].PUT } else if (ausweisart == Enums.Ausweisart.BedarfsausweisWohnen) { - patchRoute = api["bedarfsausweis-wohnen"]._uid.PATCH + patchRoute = api["bedarfsausweis-wohnen"]._id.PATCH putRoute = api["bedarfsausweis-wohnen"].PUT } - if (ausweis.uid) { + if (ausweis.id) { await patchRoute.fetch({ - ...exclude(ausweis, ["uid"]) + ...exclude(ausweis, ["id"]) }, { params: { - uid: ausweis.uid + id: ausweis.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await putRoute.fetch({ + const { id } = await putRoute.fetch({ ausweis, - uid_aufnahme: aufnahme.uid + aufnahme_id: aufnahme.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - ausweis.uid = uid; + ausweis.id = id; } - await api.aufnahme._uid.bilder.PUT.fetch(bilder.map(bild => bild.uid), { + await api.aufnahme._id.bilder.PUT.fetch(bilder.map(bild => bild.id), { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` @@ -222,29 +222,8 @@ export async function ausweisSpeichern( }) return { - uid_ausweis: ausweis.uid, - uid_aufnahme: aufnahme.uid, - uid_objekt: objekt.uid + ausweis_id: ausweis.id, + aufnahme_id: aufnahme.id, + objekt_id: objekt.id } - - - // await client.v1.tickets.erstellen.mutate({ - // titel: "Ausweis konnte nicht gespeichert werden", - // beschreibung: e.stack, - // email: user.email ?? "", - // metadata: JSON.stringify({ - // ausweis, - // }), - // }); - - // addNotification({ - // dismissable: false, - // message: - // "Ausweis konnte nicht gespeichert werden, bitte versuchen sie es erneut.", - // subtext: - // "Sollte das Problem weiterhin bestehen, kontaktieren sie bitte den Support.", - // timeout: 6000, - // type: "error", - // }); - return null; } diff --git a/src/client/lib/bilderHochladen.ts b/src/client/lib/bilderHochladen.ts deleted file mode 100644 index 11aa2176..00000000 --- a/src/client/lib/bilderHochladen.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - ObjektClient, - UploadedGebaeudeBild, - VerbrauchsausweisWohnenClient, -} from "#components/Ausweis/types.js"; -import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js"; -import { Enums } from "#lib/client/prisma"; -import { addNotification, updateNotification } from "@ibcornelsen/ui"; -import { api } from "astro-typesafe-api/client"; -import Cookies from "js-cookie"; - -export async function bilderHochladen( - images: (UploadedGebaeudeBild & { base64?: string, update?: boolean })[], - aufnahme_uid: string -) { - if (images.length == 0) { - return images; - } - - // Wenn Bilder hochgeladen werden konvertieren wir sie zu base64, das heißt, dass die base64 Eigenschaft bei diesen Bildern - // existiert. Das müssen wir TypeScript nur wissen lassen, damit es uns in Ruhe lässt. - const imagesToUpload = images.filter( - (image) => !image.uid || image.update - ) as unknown as { - data: string; - kategorie: string; - uid?: string; - update: boolean; - }[]; - - if (imagesToUpload.length == 0) { - return images; - } - - // Alle Bilder hochladen - const notification = addNotification({ - dismissable: false, - message: "Bilder hochladen.", - subtext: `${imagesToUpload.length} Bilder werden hochgeladen, bitte haben sie Geduld.`, - timeout: 0, - type: "info", - }); - for (let i = 0; i < imagesToUpload.length; i++) { - const image = imagesToUpload[i]; - - try { - if (image.update) { - await api.bilder._uid.PATCH.fetch({ - data: image.data, - kategorie: image.kategorie as Enums.BilderKategorie, - }, { - params: { - uid: image.uid as string, - }, - headers: { - "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` - } - }); - } else { - const response = await api.aufnahme._uid.bilder.PUT.fetch({ - data: image.data, - kategorie: image.kategorie as Enums.BilderKategorie - }, { - params: { - uid: aufnahme_uid - }, - headers: { - "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` - } - }); - - image.uid = response.uid; - } - - updateNotification(notification, { - dismissable: true, - message: "Bild hochgeladen.", - subtext: `${i + 1}/${ - imagesToUpload.length - } Bildern wurden erfolgreich hochgeladen.`, - timeout: 3000, - }); - } catch (e) { - updateNotification(notification, { - dismissable: true, - message: "Bild konnte nicht hochgeladen werden.", - subtext: `Eines ihrer Bilder konnte nicht hochgeladen werden. Wir haben bereits ein Ticket erstellt und melden uns so schnell wie möglich bei ihnen.`, - timeout: 15000, - type: "error", - }); - } - } - - return images; -} diff --git a/src/client/lib/nachweisSpeichern.ts b/src/client/lib/nachweisSpeichern.ts index d0ec3ca0..2bd84c6d 100644 --- a/src/client/lib/nachweisSpeichern.ts +++ b/src/client/lib/nachweisSpeichern.ts @@ -3,7 +3,7 @@ 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, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; +import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, UnterlageClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; import { Enums } from "#lib/client/prisma.js"; export async function nachweisSpeichern( @@ -14,8 +14,8 @@ export async function nachweisSpeichern( unterlagen: UnterlageClient[], ausweisart: Enums.Ausweisart ) { - if (objekt.uid) { - await api.objekt._uid.PATCH.fetch({ + if (objekt.id) { + await api.objekt._id.PATCH.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -23,14 +23,14 @@ export async function nachweisSpeichern( plz: objekt.plz }, { params: { - uid: objekt.uid + id: objekt.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.objekt.PUT.fetch({ + const { id } = await api.objekt.PUT.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -42,13 +42,13 @@ export async function nachweisSpeichern( } }) - objekt.uid = uid; + objekt.id = id; } - if (aufnahme.uid) { - await api.aufnahme._uid.PATCH.fetch({ + if (aufnahme.id) { + await api.aufnahme._id.PATCH.fetch({ baujahr_gebaeude: aufnahme.baujahr_gebaeude || [], baujahr_heizung: aufnahme.baujahr_heizung || [], baujahr_klima: aufnahme.baujahr_klima || [], @@ -103,14 +103,14 @@ export async function nachweisSpeichern( zirkulation: aufnahme.zirkulation }, { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.aufnahme.PUT.fetch({ + const { id } = await api.aufnahme.PUT.fetch({ aufnahme: { baujahr_gebaeude: aufnahme.baujahr_gebaeude, baujahr_heizung: aufnahme.baujahr_heizung, @@ -166,56 +166,56 @@ export async function nachweisSpeichern( zentralheizung: aufnahme.zentralheizung, zirkulation: aufnahme.zirkulation }, - uid_objekt: objekt.uid + objekt_id: objekt.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - aufnahme.uid = uid + aufnahme.id = id } let patchRoute: any; let putRoute: any; if (ausweisart == Enums.Ausweisart.GEGNachweisWohnen) { - patchRoute = api["geg-nachweis-wohnen"]._uid.PATCH + patchRoute = api["geg-nachweis-wohnen"]._id.PATCH putRoute = api["geg-nachweis-wohnen"].PUT } else if (ausweisart === Enums.Ausweisart.GEGNachweisGewerbe) { - patchRoute = api["geg-nachweis-gewerbe"]._uid.PATCH + patchRoute = api["geg-nachweis-gewerbe"]._id.PATCH putRoute = api["geg-nachweis-gewerbe"].PUT } else if (ausweisart === Enums.Ausweisart.BedarfsausweisGewerbe) { - patchRoute = api["bedarfsausweis-gewerbe"]._uid.PATCH + patchRoute = api["bedarfsausweis-gewerbe"]._id.PATCH putRoute = api["bedarfsausweis-gewerbe"].PUT } - if (nachweis.uid) { + if (nachweis.id) { await patchRoute.fetch({ - ...exclude(nachweis, ["uid"]) + ...exclude(nachweis, ["id"]) }, { params: { - uid: nachweis.uid + id: nachweis.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await putRoute.fetch({ + const { id } = await putRoute.fetch({ nachweis, - uid_aufnahme: aufnahme.uid + uid_aufnahme: aufnahme.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - nachweis.uid = uid; + nachweis.id = id; } - await api.aufnahme._uid.bilder.PUT.fetch(bilder.map(bild => bild.uid), { + await api.aufnahme._id.bilder.PUT.fetch(bilder.map(bild => bild.id), { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` @@ -223,8 +223,8 @@ export async function nachweisSpeichern( }) return { - uid_nachweis: nachweis.uid, - uid_aufnahme: aufnahme.uid, - uid_objekt: objekt.uid + nachweis_id: nachweis.id, + aufnahme_id: aufnahme.id, + objekt_id: objekt.id } } diff --git a/src/components/AnsichtsausweisButton.svelte b/src/components/AnsichtsausweisButton.svelte index 10167b6b..3990611b 100644 --- a/src/components/AnsichtsausweisButton.svelte +++ b/src/components/AnsichtsausweisButton.svelte @@ -1,13 +1,12 @@ diff --git a/src/components/Ausweis/AnlagenTechnik.svelte b/src/components/Ausweis/AnlagenTechnik.svelte index 757f9cc2..a3077d1b 100644 --- a/src/components/Ausweis/AnlagenTechnik.svelte +++ b/src/components/Ausweis/AnlagenTechnik.svelte @@ -2,7 +2,7 @@ import { AufnahmeClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, } from "./types.js"; import SanierungsOption from "#components/Ausweis/SanierungsOption.svelte"; import AnlagenTechnikImage from "./AnlagenTechnikImage.svelte"; @@ -11,7 +11,7 @@ export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweis: BedarfsausweisGewerbe; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[];
+


{ausweis.uid}{ausweis.id}Sie haben Hilfe zu diesem Ausweis angefordert. Sie werden innerhalb der nächsten 48 Stunden über die hinterlegte Telefonnummer vom IB Cornelsen kontaktiert.
- {:else if rechnung && rechnung.ausweistyp === Enums.AusweisTyp.Offline} + {:else if ausweis.ausweistyp === Enums.AusweisTyp.Offline}Sie haben die offline Variant zu diesem Ausweis angefordert. Bitte übermitteln Sie uns die letzten drei Jahre der Energieabrechnungen Ihres Energieversorgers.
{:else}Der Ausweis wurde von Ihnen freigegeben und befindet sich in Prüfung vom IB Cornelsen
@@ -297,27 +296,27 @@ {/if} {#if ausweis.bestellt && (!rechnung || rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung)} - + {/if} - {#if !ausweis.ausgestellt && (!ausweis.bestellt || (rechnung && rechnung.ausweistyp === Enums.AusweisTyp.Beratung || rechnung && rechnung.ausweistyp === Enums.AusweisTyp.Offline))} + {#if !ausweis.ausgestellt && (!ausweis.bestellt || (ausweis.ausweistyp === Enums.AusweisTyp.Beratung || ausweis.ausweistyp === Enums.AusweisTyp.Offline))} {#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen} Bearbeiten {:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe} Bearbeiten {/if} {/if} @@ -327,12 +326,12 @@ {#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen} Formular {:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe} Formular {/if} {/if} @@ -347,7 +346,7 @@ class="p-2 rounded-lg hover:bg-gray-200" title="PDF Herunterladen" target="_blank" - href="/pdf/ansichtsausweis?uid={ausweis.uid}" + href="/pdf/ansichtsausweis?id={ausweis.id}" >
+
{:else}
{/if}
@@ -29,14 +29,14 @@
diff --git a/src/components/DatenblattButton.svelte b/src/components/DatenblattButton.svelte
index b2164453..4fc22fe4 100644
--- a/src/components/DatenblattButton.svelte
+++ b/src/components/DatenblattButton.svelte
@@ -1,13 +1,13 @@
+
diff --git a/src/layouts/BlankLayout.astro b/src/layouts/BlankLayout.astro
index b38aa5a1..a2dc74c0 100644
--- a/src/layouts/BlankLayout.astro
+++ b/src/layouts/BlankLayout.astro
@@ -34,6 +34,22 @@ const schema = JSON.stringify({
});
---
+
+
diff --git a/src/layouts/DashboardLayout.astro b/src/layouts/DashboardLayout.astro
index 0a88f9b6..c0669610 100644
--- a/src/layouts/DashboardLayout.astro
+++ b/src/layouts/DashboardLayout.astro
@@ -23,7 +23,7 @@ const { title, user } = Astro.props;
const objekte = await prisma.objekt.findMany({
where: {
benutzer: {
- uid: user.uid
+ id: user.id
}
},
take: 10,
@@ -71,6 +71,22 @@ const schema = JSON.stringify({
let lightTheme = Astro.cookies.get("theme")?.value === "light";
---
+
+
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index e37e6fd7..b909f06f 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -19,6 +19,20 @@ const { title } = Astro.props;
---