Highlight und neue ID
This commit is contained in:
26
bun.lock
26
bun.lock
@@ -9,6 +9,7 @@
|
|||||||
"@astrojs/svelte": "^2.2.0",
|
"@astrojs/svelte": "^2.2.0",
|
||||||
"@astrojs/tailwind": "^3.1.3",
|
"@astrojs/tailwind": "^3.1.3",
|
||||||
"@aws-sdk/client-s3": "^3.758.0",
|
"@aws-sdk/client-s3": "^3.758.0",
|
||||||
|
"@highlight-run/node": "^3.12.0",
|
||||||
"@ibcornelsen/ui": "^0.0.2",
|
"@ibcornelsen/ui": "^0.0.2",
|
||||||
"@mollie/api-client": "^4.1.0",
|
"@mollie/api-client": "^4.1.0",
|
||||||
"@pdfme/common": "^5.2.16",
|
"@pdfme/common": "^5.2.16",
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"flag-icons": "^6.15.0",
|
"flag-icons": "^6.15.0",
|
||||||
"fontkit": "^2.0.4",
|
"fontkit": "^2.0.4",
|
||||||
|
"highlight.run": "^9.14.0",
|
||||||
"is-base64": "^1.1.0",
|
"is-base64": "^1.1.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"js-interpolate": "^1.3.2",
|
"js-interpolate": "^1.3.2",
|
||||||
@@ -346,6 +348,8 @@
|
|||||||
|
|
||||||
"@hapi/bourne": ["@hapi/bourne@3.0.0", "", {}, "sha512-Waj1cwPXJDucOib4a3bAISsKJVb15MKi9IvmTI/7ssVEm6sywXGjVJDhl6/umt1pK1ZS7PacXU3A1PmFKHEZ2w=="],
|
"@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/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=="],
|
"@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": ["@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=="],
|
"@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=="],
|
"@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/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/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=="],
|
"@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/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/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=="],
|
"@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": ["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=="],
|
"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=="],
|
"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=="],
|
"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=="],
|
"classnames": ["classnames@2.5.1", "", {}, "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="],
|
||||||
|
|
||||||
"clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="],
|
"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=="],
|
"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=="],
|
"hosted-git-info": ["hosted-git-info@2.8.9", "", {}, "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="],
|
||||||
|
|
||||||
"hotkeys-js": ["hotkeys-js@3.13.9", "", {}, "sha512-3TRCj9u9KUH6cKo25w4KIdBfdBfNRjfUwrljCLDC2XhmPDG0SjAZFcFZekpUZFmXzfYoGhFDcdx2gX/vUVtztQ=="],
|
"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-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=="],
|
"import-meta-resolve": ["import-meta-resolve@4.1.0", "", {}, "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw=="],
|
||||||
|
|
||||||
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
||||||
@@ -1862,6 +1882,8 @@
|
|||||||
|
|
||||||
"mkdirp": ["mkdirp@1.0.4", "", { "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="],
|
"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": ["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=="],
|
"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=="],
|
"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=="],
|
"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=="],
|
"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=="],
|
"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": ["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=="],
|
"side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from "cypress";
|
import { defineConfig } from "cypress";
|
||||||
import dsv from "@rollup/plugin-dsv"
|
import dsv from "@rollup/plugin-dsv"
|
||||||
|
import { prisma } from "./src/lib/server/prisma"
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import vitePreprocessor from "cypress-vite";
|
import vitePreprocessor from "cypress-vite";
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
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)),
|
"#": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
"#components": fileURLToPath(new URL("./src/components", import.meta.url)),
|
"#components": fileURLToPath(new URL("./src/components", import.meta.url)),
|
||||||
"#lib": fileURLToPath(new URL("./src/lib", import.meta.url))
|
"#lib": fileURLToPath(new URL("./src/lib", import.meta.url))
|
||||||
@@ -31,6 +32,11 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
plugins: [dsv()]
|
plugins: [dsv()]
|
||||||
}))
|
}))
|
||||||
|
on("task", {
|
||||||
|
async verbrauchsausweisWohnen(query) {
|
||||||
|
return await prisma.verbrauchsausweisWohnen.findFirst(query)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
component: {
|
component: {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"@astrojs/svelte": "^2.2.0",
|
"@astrojs/svelte": "^2.2.0",
|
||||||
"@astrojs/tailwind": "^3.1.3",
|
"@astrojs/tailwind": "^3.1.3",
|
||||||
"@aws-sdk/client-s3": "^3.758.0",
|
"@aws-sdk/client-s3": "^3.758.0",
|
||||||
|
"@highlight-run/node": "^3.12.0",
|
||||||
"@ibcornelsen/ui": "^0.0.2",
|
"@ibcornelsen/ui": "^0.0.2",
|
||||||
"@mollie/api-client": "^4.1.0",
|
"@mollie/api-client": "^4.1.0",
|
||||||
"@pdfme/common": "^5.2.16",
|
"@pdfme/common": "^5.2.16",
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"flag-icons": "^6.15.0",
|
"flag-icons": "^6.15.0",
|
||||||
"fontkit": "^2.0.4",
|
"fontkit": "^2.0.4",
|
||||||
|
"highlight.run": "^9.14.0",
|
||||||
"is-base64": "^1.1.0",
|
"is-base64": "^1.1.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"js-interpolate": "^1.3.2",
|
"js-interpolate": "^1.3.2",
|
||||||
|
|||||||
573
prisma/migrations/20250324210605_id/migration.sql
Normal file
573
prisma/migrations/20250324210605_id/migration.sql
Normal file
@@ -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;
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
model Anteilshaber {
|
model Anteilshaber {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
benutzer_id Int
|
|
||||||
rolle String? @db.VarChar
|
rolle String? @db.VarChar
|
||||||
privilegien BigInt?
|
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)
|
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)
|
objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
model ApiRequests {
|
model ApiRequests {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
date DateTime @default(now()) @db.Timestamp(6)
|
date DateTime @default(now()) @db.Timestamp(6)
|
||||||
ip String @db.VarChar(50)
|
ip String @db.VarChar(50)
|
||||||
method String @db.VarChar(10)
|
method String @db.VarChar(10)
|
||||||
@@ -9,6 +9,6 @@ model ApiRequests {
|
|||||||
responseTime Float
|
responseTime Float
|
||||||
responseSize Int
|
responseSize Int
|
||||||
userAgent String @db.VarChar(500)
|
userAgent String @db.VarChar(500)
|
||||||
user_id Int?
|
user_id String?
|
||||||
user Benutzer? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
user Benutzer? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,8 @@ enum Lueftungskonzept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Aufnahme {
|
model Aufnahme {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
/// @zod.describe("UID der Gebäude Aufnahme")
|
benutzer_id String?
|
||||||
uid String @unique @default(dbgenerated("'auf-' || gen_random_uuid()"))
|
|
||||||
benutzer_id Int?
|
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
/// @zod.describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen")
|
/// @zod.describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen")
|
||||||
ausweisart Ausweisart?
|
ausweisart Ausweisart?
|
||||||
@@ -142,7 +140,7 @@ model Aufnahme {
|
|||||||
geg_nachweise_gewerbe GEGNachweisGewerbe[]
|
geg_nachweise_gewerbe GEGNachweisGewerbe[]
|
||||||
bedarfsausweise_gewerbe BedarfsausweisGewerbe[]
|
bedarfsausweise_gewerbe BedarfsausweisGewerbe[]
|
||||||
|
|
||||||
objekt_id Int
|
objekt_id String
|
||||||
objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
objekt Objekt @relation(fields: [objekt_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
model BedarfsausweisGewerbe {
|
model BedarfsausweisGewerbe {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'bag-' || gen_random_uuid()"))
|
|
||||||
|
|
||||||
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
@@ -27,13 +26,13 @@ model BedarfsausweisGewerbe {
|
|||||||
klimatisierung Boolean? @default(false)
|
klimatisierung Boolean? @default(false)
|
||||||
|
|
||||||
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
|
/// @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)
|
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)
|
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)
|
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)
|
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
model BedarfsausweisWohnen {
|
model BedarfsausweisWohnen {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
alte_ausweis_id Int?
|
alte_ausweis_id Int?
|
||||||
uid String @unique @default(dbgenerated("'baw-' || gen_random_uuid()"))
|
benutzer_id String?
|
||||||
benutzer_id Int?
|
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
registriernummer String? @db.VarChar
|
registriernummer String? @db.VarChar
|
||||||
|
|
||||||
@@ -83,10 +82,10 @@ model BedarfsausweisWohnen {
|
|||||||
|
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
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)
|
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
|
|
||||||
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
|
/// @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)
|
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ enum BenutzerRolle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Benutzer {
|
model Benutzer {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'usr-' || gen_random_uuid()"))
|
|
||||||
name String? @db.VarChar(50)
|
name String? @db.VarChar(50)
|
||||||
vorname String? @db.VarChar(50)
|
vorname String? @db.VarChar(50)
|
||||||
email String @unique(map: "benutzer_email_idx") @db.VarChar(255)
|
email String @unique(map: "benutzer_email_idx") @db.VarChar(255)
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ enum BilderKategorie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Bild {
|
model Bild {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
kategorie BilderKategorie
|
kategorie BilderKategorie
|
||||||
uid String @unique @default(dbgenerated("'img-' || gen_random_uuid()"))
|
|
||||||
name String
|
name String
|
||||||
|
|
||||||
aufnahme_id Int?
|
aufnahme_id String?
|
||||||
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
// Hier werden beispielsweise Events wie "Nachricht Verschickt" gespeichert.
|
// Hier werden beispielsweise Events wie "Nachricht Verschickt" gespeichert.
|
||||||
// Diese Events werden dann in der Admin-Oberfläche angezeigt.
|
// Diese Events werden dann in der Admin-Oberfläche angezeigt.
|
||||||
model Event {
|
model Event {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'evt-' || gen_random_uuid()"))
|
|
||||||
date DateTime @default(now()) @db.Timestamp(6)
|
date DateTime @default(now()) @db.Timestamp(6)
|
||||||
|
|
||||||
title String @db.VarChar(255)
|
title String @db.VarChar(255)
|
||||||
@@ -12,9 +11,9 @@ model Event {
|
|||||||
|
|
||||||
|
|
||||||
// Verlinkung des Gebäudes
|
// Verlinkung des Gebäudes
|
||||||
aufnahme_id Int
|
aufnahme_id String
|
||||||
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
// Verlinkung des Benutzers
|
// Verlinkung des Benutzers
|
||||||
benutzer_id Int?
|
benutzer_id String?
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ enum Einpreisungsstatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model GEGEinpreisung {
|
model GEGEinpreisung {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'gge-' || gen_random_uuid()"))
|
|
||||||
|
|
||||||
empfaenger String? @db.VarChar
|
empfaenger String? @db.VarChar
|
||||||
strasse String? @db.VarChar
|
strasse String? @db.VarChar
|
||||||
@@ -31,6 +30,6 @@ model GEGEinpreisung {
|
|||||||
bedarfsausweis_gewerbe BedarfsausweisGewerbe?
|
bedarfsausweis_gewerbe BedarfsausweisGewerbe?
|
||||||
|
|
||||||
/// @zod.describe("Die ID des Benutzers, der diese Einpreisung bekommt.")
|
/// @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)
|
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
model GEGNachweisGewerbe {
|
model GEGNachweisGewerbe {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'gng-' || gen_random_uuid()"))
|
|
||||||
|
|
||||||
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
@@ -18,13 +17,13 @@ model GEGNachweisGewerbe {
|
|||||||
beschreibung String? @db.Text
|
beschreibung String? @db.Text
|
||||||
|
|
||||||
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
|
/// @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)
|
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)
|
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)
|
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)
|
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
model GEGNachweisWohnen {
|
model GEGNachweisWohnen {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'gnw-' || gen_random_uuid()"))
|
|
||||||
|
|
||||||
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
@@ -18,13 +17,13 @@ model GEGNachweisWohnen {
|
|||||||
beschreibung String? @db.Text
|
beschreibung String? @db.Text
|
||||||
|
|
||||||
/// @zod.describe("Die ID des Benutzers, welchem dieser Ausweis gehört")
|
/// @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)
|
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)
|
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)
|
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)
|
geg_einpreisung GEGEinpreisung? @relation(fields: [geg_einpreisung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
model Objekt {
|
model Objekt {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'obj-' || gen_random_uuid()"))
|
|
||||||
benutzer_id Int?
|
|
||||||
|
|
||||||
latitude Float?
|
latitude Float?
|
||||||
longitude Float?
|
longitude Float?
|
||||||
@@ -15,6 +13,7 @@ model Objekt {
|
|||||||
|
|
||||||
erstellungsdatum DateTime? @default(now())
|
erstellungsdatum DateTime? @default(now())
|
||||||
|
|
||||||
|
benutzer_id String?
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id])
|
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id])
|
||||||
aufnahmen Aufnahme[]
|
aufnahmen Aufnahme[]
|
||||||
anteilshaber Anteilshaber[]
|
anteilshaber Anteilshaber[]
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ enum AusweisTyp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Rechnung {
|
model Rechnung {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'inv-' || gen_random_uuid()"))
|
|
||||||
|
|
||||||
benutzer_id Int
|
|
||||||
empfaenger String? @db.VarChar
|
empfaenger String? @db.VarChar
|
||||||
strasse String? @db.VarChar
|
strasse String? @db.VarChar
|
||||||
plz String? @db.VarChar
|
plz String? @db.VarChar
|
||||||
@@ -52,6 +50,7 @@ model Rechnung {
|
|||||||
storniert_am DateTime?
|
storniert_am DateTime?
|
||||||
transaktions_referenz String? @unique @db.VarChar
|
transaktions_referenz String? @unique @db.VarChar
|
||||||
|
|
||||||
|
benutzer_id String
|
||||||
benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
benutzer Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
|
|
||||||
verbrauchsausweis_wohnen VerbrauchsausweisWohnen?
|
verbrauchsausweis_wohnen VerbrauchsausweisWohnen?
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
model RefreshTokens {
|
model RefreshTokens {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
benutzer_id Int
|
|
||||||
token String @unique
|
token String @unique
|
||||||
// Wir nehmen die IP Adresse des Clients mit auf.
|
// 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.
|
// Falls sich die IP Adresse eines Refresh Token Owners ändert, können wir diesen einfach invalidieren.
|
||||||
@@ -9,5 +8,6 @@ model RefreshTokens {
|
|||||||
expiry DateTime
|
expiry DateTime
|
||||||
|
|
||||||
// Relationen
|
// Relationen
|
||||||
|
benutzer_id String
|
||||||
user Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: Cascade)
|
user Benutzer @relation(fields: [benutzer_id], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
@@ -8,9 +8,7 @@ enum TicketStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Tickets {
|
model Tickets {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'tkt-' || gen_random_uuid()"))
|
|
||||||
benutzer_id Int?
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime? @updatedAt
|
updated_at DateTime? @updatedAt
|
||||||
deleted_at DateTime?
|
deleted_at DateTime?
|
||||||
@@ -21,10 +19,11 @@ model Tickets {
|
|||||||
metadata Json?
|
metadata Json?
|
||||||
email String
|
email String
|
||||||
|
|
||||||
bearbeiter_id Int?
|
bearbeiter_id String?
|
||||||
prioritaet Int? @default(0)
|
prioritaet Int? @default(0)
|
||||||
|
|
||||||
// Relationen
|
// Relationen
|
||||||
|
benutzer_id String?
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], name: "ErstellteTickets")
|
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], name: "ErstellteTickets")
|
||||||
bearbeiter Benutzer? @relation(fields: [bearbeiter_id], references: [id], name: "BearbeiteteTickets")
|
bearbeiter Benutzer? @relation(fields: [bearbeiter_id], references: [id], name: "BearbeiteteTickets")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,11 @@ enum UnterlagenKategorie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Unterlage {
|
model Unterlage {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
uid String @unique @default(dbgenerated("'pln-' || gen_random_uuid()"))
|
|
||||||
name String?
|
name String?
|
||||||
kategorie String?
|
kategorie String?
|
||||||
mime String?
|
mime String?
|
||||||
|
|
||||||
aufnahme_id Int?
|
aufnahme_id String?
|
||||||
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
aufnahme Aufnahme? @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
model VerbrauchsausweisGewerbe {
|
model VerbrauchsausweisGewerbe {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @unique @db.VarChar(8)
|
||||||
alte_ausweis_id Int?
|
alte_ausweis_id Int?
|
||||||
uid String @unique @default(dbgenerated("'vag-' || gen_random_uuid()"))
|
|
||||||
benutzer_id Int?
|
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
registriernummer String? @db.VarChar
|
registriernummer String? @db.VarChar
|
||||||
zusaetzliche_heizquelle Boolean?
|
zusaetzliche_heizquelle Boolean?
|
||||||
@@ -68,12 +66,13 @@ model VerbrauchsausweisGewerbe {
|
|||||||
|
|
||||||
ausweistyp AusweisTyp @default(Standard)
|
ausweistyp AusweisTyp @default(Standard)
|
||||||
|
|
||||||
|
benutzer_id String?
|
||||||
benutzer Benutzer? @relation(fields: [benutzer_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
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)
|
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
|
|
||||||
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
|
/// @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)
|
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
|
|
||||||
model VerbrauchsausweisWohnen {
|
model VerbrauchsausweisWohnen {
|
||||||
id Int @id @default(autoincrement())
|
/// @zod.describe("ID des Ausweises")
|
||||||
|
id String @id @unique @db.VarChar(8)
|
||||||
alte_ausweis_id Int?
|
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")
|
/// @zod.describe("Ausstellgrund wie z.B. Vermietung oder Verkauf")
|
||||||
ausstellgrund Ausstellgrund?
|
ausstellgrund Ausstellgrund?
|
||||||
/// @zod.describe("Die Registriernummer des Ausweises")
|
/// @zod.describe("Die Registriernummer des Ausweises")
|
||||||
@@ -72,12 +69,14 @@ model VerbrauchsausweisWohnen {
|
|||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
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)
|
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)
|
rechnung Rechnung? @relation(fields: [rechnung_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
|
|
||||||
/// @zod.describe("ID der korrespondierenden Gebäudeaufnahme")
|
/// @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)
|
aufnahme Aufnahme @relation(fields: [aufnahme_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ model documenttemplates {
|
|||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
shortdescription String @db.VarChar(100)
|
shortdescription String @db.VarChar(100)
|
||||||
longdescription String @db.VarChar(5000)
|
longdescription String @db.VarChar(5000)
|
||||||
user_id Int
|
user_id String
|
||||||
is_private Boolean @default(true)
|
is_private Boolean @default(true)
|
||||||
documenttype Int
|
documenttype Int
|
||||||
filename String @db.VarChar(100)
|
filename String @db.VarChar(100)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
model tokens {
|
model tokens {
|
||||||
id Int @id(map: "PK_TOKENS") @default(autoincrement())
|
id Int @id(map: "PK_TOKENS") @default(autoincrement())
|
||||||
token String @db.VarChar(36)
|
token String @db.VarChar(36)
|
||||||
user_id Int
|
user_id String
|
||||||
date_created DateTime @default(now()) @db.Timestamp(6)
|
date_created DateTime @default(now()) @db.Timestamp(6)
|
||||||
last_used DateTime @default(now()) @db.Timestamp(6)
|
last_used DateTime @default(now()) @db.Timestamp(6)
|
||||||
times_used Int @default(0)
|
times_used Int @default(0)
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ await prisma.benutzer.create({
|
|||||||
vorname: "Admin",
|
vorname: "Admin",
|
||||||
adresse: "Adminstraße 1",
|
adresse: "Adminstraße 1",
|
||||||
plz: "12345",
|
plz: "12345",
|
||||||
|
id: "USADMIN1"
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -106,6 +107,7 @@ await prisma.benutzer.create({
|
|||||||
vorname: "User",
|
vorname: "User",
|
||||||
adresse: "Userstraße 1",
|
adresse: "Userstraße 1",
|
||||||
plz: "12345",
|
plz: "12345",
|
||||||
|
id: "USUSER01"
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
16
server.ts
16
server.ts
@@ -1,7 +1,21 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import { H, Handlers } from '@highlight-run/node'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { handler as ssrHandler } from './dist/server/entry.mjs';
|
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 app = express();
|
||||||
const base = '/';
|
const base = '/';
|
||||||
@@ -9,6 +23,8 @@ app.use(base, express.static('dist/client/'));
|
|||||||
app.use(ssrHandler);
|
app.use(ssrHandler);
|
||||||
app.use(express.json({ limit: "50mb" }))
|
app.use(express.json({ limit: "50mb" }))
|
||||||
app.use(express.urlencoded({ limit: "50mb" }))
|
app.use(express.urlencoded({ limit: "50mb" }))
|
||||||
|
app.use(Handlers.middleware(highlightConfig))
|
||||||
|
app.use(Handlers.errorHandler(highlightConfig))
|
||||||
|
|
||||||
app.listen(3000, function() {
|
app.listen(3000, function() {
|
||||||
console.log('Server started on http://localhost:3000');
|
console.log('Server started on http://localhost:3000');
|
||||||
|
|||||||
@@ -12,34 +12,34 @@ export const createCaller = createCallerFactory({
|
|||||||
"admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"),
|
"admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"),
|
||||||
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
|
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
|
||||||
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
|
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
|
||||||
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
"bedarfsausweis-gewerbe/[uid]": await import("../src/pages/api/bedarfsausweis-gewerbe/[uid].ts"),
|
||||||
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
"bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
|
||||||
"auth/access-token": await import("../src/pages/api/auth/access-token.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/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
|
||||||
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.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"),
|
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
||||||
"bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
|
"aufnahme": await import("../src/pages/api/aufnahme/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"),
|
"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/[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-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/[uid]": await import("../src/pages/api/geg-nachweis-wohnen/[uid].ts"),
|
||||||
"geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
|
"geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
|
||||||
"objekt": await import("../src/pages/api/objekt/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/anfordern": await import("../src/pages/api/rechnung/anfordern.ts"),
|
||||||
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
||||||
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
||||||
"user": await import("../src/pages/api/user/index.ts"),
|
"user": await import("../src/pages/api/user/index.ts"),
|
||||||
"user/self": await import("../src/pages/api/user/self.ts"),
|
"user/self": await import("../src/pages/api/user/self.ts"),
|
||||||
"verbrauchsausweis-wohnen/[uid]": await import("../src/pages/api/verbrauchsausweis-wohnen/[uid].ts"),
|
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].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": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.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"),
|
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||||
"aufnahme/[uid]/bilder": await import("../src/pages/api/aufnahme/[uid]/bilder.ts"),
|
"aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.ts"),
|
||||||
"aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid]/index.ts"),
|
"aufnahme/[id]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
|
||||||
"aufnahme/[uid]/unterlagen": await import("../src/pages/api/aufnahme/[uid]/unterlagen.ts"),
|
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
||||||
"objekt/[uid]": await import("../src/pages/api/objekt/[uid]/index.ts"),
|
"objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"),
|
||||||
})
|
})
|
||||||
@@ -13,8 +13,8 @@ export async function ausweisSpeichern(
|
|||||||
bilder: BildClient[],
|
bilder: BildClient[],
|
||||||
ausweisart: Enums.Ausweisart
|
ausweisart: Enums.Ausweisart
|
||||||
) {
|
) {
|
||||||
if (objekt.uid) {
|
if (objekt.id) {
|
||||||
await api.objekt._uid.PATCH.fetch({
|
await api.objekt._id.PATCH.fetch({
|
||||||
adresse: objekt.adresse,
|
adresse: objekt.adresse,
|
||||||
latitude: 0,
|
latitude: 0,
|
||||||
longitude: 0,
|
longitude: 0,
|
||||||
@@ -22,14 +22,14 @@ export async function ausweisSpeichern(
|
|||||||
plz: objekt.plz
|
plz: objekt.plz
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
uid: objekt.uid
|
id: objekt.id
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const { uid } = await api.objekt.PUT.fetch({
|
const { id } = await api.objekt.PUT.fetch({
|
||||||
adresse: objekt.adresse,
|
adresse: objekt.adresse,
|
||||||
latitude: 0,
|
latitude: 0,
|
||||||
longitude: 0,
|
longitude: 0,
|
||||||
@@ -41,16 +41,16 @@ export async function ausweisSpeichern(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
objekt.uid = uid;
|
objekt.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (aufnahme.uid) {
|
if (aufnahme.id) {
|
||||||
await api.aufnahme._uid.PATCH.fetch({
|
await api.aufnahme._id.PATCH.fetch({
|
||||||
baujahr_gebaeude: aufnahme.baujahr_gebaeude,
|
baujahr_gebaeude: aufnahme.baujahr_gebaeude,
|
||||||
baujahr_heizung: aufnahme.baujahr_heizung,
|
baujahr_heizung: aufnahme.baujahr_heizung,
|
||||||
baujahr_klima: aufnahme.baujahr_klima,
|
baujahr_klima: aufnahme.baujahr_klima || [],
|
||||||
alternative_heizung: aufnahme.alternative_heizung,
|
alternative_heizung: aufnahme.alternative_heizung,
|
||||||
alternative_kuehlung: aufnahme.alternative_kuehlung,
|
alternative_kuehlung: aufnahme.alternative_kuehlung,
|
||||||
alternative_lueftung: aufnahme.alternative_lueftung,
|
alternative_lueftung: aufnahme.alternative_lueftung,
|
||||||
@@ -102,14 +102,14 @@ export async function ausweisSpeichern(
|
|||||||
zirkulation: aufnahme.zirkulation
|
zirkulation: aufnahme.zirkulation
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
uid: aufnahme.uid
|
id: aufnahme.id
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const { uid } = await api.aufnahme.PUT.fetch({
|
const { id } = await api.aufnahme.PUT.fetch({
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
baujahr_gebaeude: aufnahme.baujahr_gebaeude,
|
baujahr_gebaeude: aufnahme.baujahr_gebaeude,
|
||||||
baujahr_heizung: aufnahme.baujahr_heizung,
|
baujahr_heizung: aufnahme.baujahr_heizung,
|
||||||
@@ -165,56 +165,56 @@ export async function ausweisSpeichern(
|
|||||||
zentralheizung: aufnahme.zentralheizung,
|
zentralheizung: aufnahme.zentralheizung,
|
||||||
zirkulation: aufnahme.zirkulation
|
zirkulation: aufnahme.zirkulation
|
||||||
},
|
},
|
||||||
uid_objekt: objekt.uid
|
objekt_id: objekt.id
|
||||||
}, {
|
}, {
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
aufnahme.uid = uid
|
aufnahme.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
let patchRoute: any;
|
let patchRoute: any;
|
||||||
let putRoute: any;
|
let putRoute: any;
|
||||||
if (ausweisart == Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
if (ausweisart == Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||||
patchRoute = api["verbrauchsausweis-wohnen"]._uid.PATCH
|
patchRoute = api["verbrauchsausweis-wohnen"]._id.PATCH
|
||||||
putRoute = api["verbrauchsausweis-wohnen"].PUT
|
putRoute = api["verbrauchsausweis-wohnen"].PUT
|
||||||
} else if (ausweisart == Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
} else if (ausweisart == Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||||
patchRoute = api["verbrauchsausweis-gewerbe"]._uid.PATCH
|
patchRoute = api["verbrauchsausweis-gewerbe"]._id.PATCH
|
||||||
putRoute = api["verbrauchsausweis-gewerbe"].PUT
|
putRoute = api["verbrauchsausweis-gewerbe"].PUT
|
||||||
} else if (ausweisart == Enums.Ausweisart.BedarfsausweisWohnen) {
|
} else if (ausweisart == Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||||
patchRoute = api["bedarfsausweis-wohnen"]._uid.PATCH
|
patchRoute = api["bedarfsausweis-wohnen"]._id.PATCH
|
||||||
putRoute = api["bedarfsausweis-wohnen"].PUT
|
putRoute = api["bedarfsausweis-wohnen"].PUT
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ausweis.uid) {
|
if (ausweis.id) {
|
||||||
await patchRoute.fetch({
|
await patchRoute.fetch({
|
||||||
...exclude(ausweis, ["uid"])
|
...exclude(ausweis, ["id"])
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
uid: ausweis.uid
|
id: ausweis.id
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const { uid } = await putRoute.fetch({
|
const { id } = await putRoute.fetch({
|
||||||
ausweis,
|
ausweis,
|
||||||
uid_aufnahme: aufnahme.uid
|
aufnahme_id: aufnahme.id
|
||||||
}, {
|
}, {
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"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: {
|
params: {
|
||||||
uid: aufnahme.uid
|
id: aufnahme.id
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
@@ -222,29 +222,8 @@ export async function ausweisSpeichern(
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid_ausweis: ausweis.uid,
|
ausweis_id: ausweis.id,
|
||||||
uid_aufnahme: aufnahme.uid,
|
aufnahme_id: aufnahme.id,
|
||||||
uid_objekt: objekt.uid
|
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;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
|
|
||||||
openWindowWithPost("/kundendaten", {
|
openWindowWithPost("/kundendaten", {
|
||||||
ausweis,
|
ausweis: { ...ausweis, ausweistyp },
|
||||||
objekt,
|
objekt,
|
||||||
aufnahme,
|
aufnahme,
|
||||||
bilder,
|
bilder,
|
||||||
@@ -80,11 +80,11 @@
|
|||||||
window.history.pushState(
|
window.history.pushState(
|
||||||
{},
|
{},
|
||||||
"",
|
"",
|
||||||
`${location.pathname}?uid=${ausweis.uid}`
|
`${location.pathname}?uid=${ausweis.id}`
|
||||||
);
|
);
|
||||||
|
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
window.location.href = `/speichern-erfolgreich?uid=${ausweis.uid}`
|
window.location.href = `/speichern-erfolgreich?uid=${ausweis.id}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,8 @@ export type UploadedGebaeudeBild = OmitKeys<Bild, "id" | "aufnahme_id"> & {
|
|||||||
* @export
|
* @export
|
||||||
* @typedef {VerbrauchsausweisWohnenClient}
|
* @typedef {VerbrauchsausweisWohnenClient}
|
||||||
*/
|
*/
|
||||||
export type VerbrauchsausweisWohnenClient = OmitKeys<
|
export type VerbrauchsausweisWohnenClient = VerbrauchsausweisWohnen & {
|
||||||
VerbrauchsausweisWohnen,
|
objekt_id: string
|
||||||
"id" | "aufnahme_id" | "benutzer_id"
|
|
||||||
> & {
|
|
||||||
uid_objekt: string,
|
|
||||||
uid_aufnahme: string,
|
|
||||||
uid_benutzer?: string
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,13 +45,8 @@ export type VerbrauchsausweisWohnenClient = OmitKeys<
|
|||||||
* @export
|
* @export
|
||||||
* @typedef {VerbrauchsausweisWohnenClient}
|
* @typedef {VerbrauchsausweisWohnenClient}
|
||||||
*/
|
*/
|
||||||
export type VerbrauchsausweisGewerbeClient = OmitKeys<
|
export type VerbrauchsausweisGewerbeClient = VerbrauchsausweisGewerbe & {
|
||||||
VerbrauchsausweisGewerbe,
|
objekt_id: string
|
||||||
"id" | "aufnahme_id" | "benutzer_id"
|
|
||||||
> & {
|
|
||||||
uid_objekt: string,
|
|
||||||
uid_aufnahme: string,
|
|
||||||
uid_benutzer?: string
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,13 +59,8 @@ export type VerbrauchsausweisGewerbeClient = OmitKeys<
|
|||||||
* @export
|
* @export
|
||||||
* @typedef {VerbrauchsausweisWohnenClient}
|
* @typedef {VerbrauchsausweisWohnenClient}
|
||||||
*/
|
*/
|
||||||
export type BedarfsausweisWohnenClient = OmitKeys<
|
export type BedarfsausweisWohnenClient = BedarfsausweisWohnen & {
|
||||||
BedarfsausweisWohnen,
|
objekt_id: string
|
||||||
"id" | "aufnahme_id" | "benutzer_id"
|
|
||||||
> & {
|
|
||||||
uid_objekt: string,
|
|
||||||
uid_aufnahme: string,
|
|
||||||
uid_benutzer?: string
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,20 +73,15 @@ export type BedarfsausweisWohnenClient = OmitKeys<
|
|||||||
* @export
|
* @export
|
||||||
* @typedef {ObjektClient}
|
* @typedef {ObjektClient}
|
||||||
*/
|
*/
|
||||||
export type ObjektClient = OmitKeys<Objekt, "benutzer_id" | "id">;
|
export type ObjektClient = Objekt;
|
||||||
|
|
||||||
export type AufnahmeClient = OmitKeys<
|
export type AufnahmeClient = Aufnahme
|
||||||
Aufnahme,
|
|
||||||
"id" | "objekt_id" | "benutzer_id"
|
|
||||||
> & {
|
|
||||||
uid_objekt: string
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TicketClient = OmitKeys<Tickets, "bearbeiter_id" | "benutzer_id" | "id">
|
export type TicketClient = OmitKeys<Tickets, "bearbeiter_id" | "benutzer_id" | "id">
|
||||||
|
|
||||||
export type BenutzerClient = OmitKeys<Benutzer, "id" | "passwort">;
|
export type BenutzerClient = OmitKeys<Benutzer, "passwort">;
|
||||||
|
|
||||||
export type RechnungClient = OmitKeys<Rechnung, "id">
|
export type RechnungClient = Rechnung
|
||||||
|
|
||||||
export function ZodOverlap<T, S = z.ZodType<T, z.ZodTypeDef, T>>(arg: S): S {
|
export function ZodOverlap<T, S = z.ZodType<T, z.ZodTypeDef, T>>(arg: S): S {
|
||||||
return arg;
|
return arg;
|
||||||
@@ -122,34 +102,34 @@ export type OptionalNullable<T> = T extends object ? {
|
|||||||
} : T;
|
} : T;
|
||||||
|
|
||||||
export const UUidWithPrefix = z.string().refine((value) => {
|
export const UUidWithPrefix = z.string().refine((value) => {
|
||||||
const prefixedUUidRegex = /^([0-9a-z]+)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
const prefixedUUidRegex = /^([A-Z]{2})[0-9A-Z]{6}$/i
|
||||||
|
|
||||||
const match = value.match(prefixedUUidRegex)
|
const match = value.match(prefixedUUidRegex)
|
||||||
|
|
||||||
if (match && match[1] in VALID_UUID_PREFIXES) {
|
if (match && Object.values(VALID_UUID_PREFIXES).indexOf(match[1] as VALID_UUID_PREFIXES) > -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
export function getAusweisartFromUUID(uid: string): Enums.Ausweisart | null {
|
export function getAusweisartFromUUID(id: string): Enums.Ausweisart | null {
|
||||||
if (!UUidWithPrefix.safeParse(uid).success) {
|
if (!UUidWithPrefix.safeParse(id).success) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(uid.split("-")[0]) {
|
switch(id.slice(0, 2) as VALID_UUID_PREFIXES) {
|
||||||
case "vaw":
|
case VALID_UUID_PREFIXES.VerbrauchsausweisWohnen:
|
||||||
return Enums.Ausweisart.VerbrauchsausweisWohnen
|
return Enums.Ausweisart.VerbrauchsausweisWohnen
|
||||||
case "vag":
|
case VALID_UUID_PREFIXES.VerbrauchsausweisGewerbe:
|
||||||
return Enums.Ausweisart.VerbrauchsausweisGewerbe
|
return Enums.Ausweisart.VerbrauchsausweisGewerbe
|
||||||
case "baw":
|
case VALID_UUID_PREFIXES.BedarfsausweisWohnen:
|
||||||
return Enums.Ausweisart.BedarfsausweisWohnen
|
return Enums.Ausweisart.BedarfsausweisWohnen
|
||||||
case "bag":
|
case VALID_UUID_PREFIXES.BedarfsausweisGewerbe:
|
||||||
return Enums.Ausweisart.BedarfsausweisGewerbe
|
return Enums.Ausweisart.BedarfsausweisGewerbe
|
||||||
case "gnw":
|
case VALID_UUID_PREFIXES.GEGNachweisWohnen:
|
||||||
return Enums.Ausweisart.GEGNachweisWohnen
|
return Enums.Ausweisart.GEGNachweisWohnen
|
||||||
case "gng":
|
case VALID_UUID_PREFIXES.GEGNachweisGewerbe:
|
||||||
return Enums.Ausweisart.GEGNachweisGewerbe
|
return Enums.Ausweisart.GEGNachweisGewerbe
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PRICES } from "#lib/constants.js";
|
import { PRICES } from "#lib/constants.js";
|
||||||
import { Enums } from "#lib/client/prisma";
|
import { Enums } from "#lib/client/prisma.js";
|
||||||
export let bullets;
|
export let bullets;
|
||||||
export let title;
|
export let title;
|
||||||
export let ref = "";
|
export let ref = "";
|
||||||
@@ -56,9 +56,9 @@ bullets = [
|
|||||||
|
|
||||||
<div class="zeile grid grid-cols-subgrid col-span-4 py-4 border-b-[0px] justify-items-center items-center">
|
<div class="zeile grid grid-cols-subgrid col-span-4 py-4 border-b-[0px] justify-items-center items-center">
|
||||||
<div class="justify-self-start pl-2"></div>
|
<div class="justify-self-start pl-2"></div>
|
||||||
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Standard}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
||||||
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Beratung}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
||||||
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Offline}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import fuelList from "#components/Ausweis/brennstoffListe.js";
|
import fuelList from "#components/Ausweis/brennstoffListe.js";
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
import { type Enums } from "#lib/client/prisma";
|
import { type Enums } from "#lib/client/prisma.js";
|
||||||
import "cypress-file-upload"
|
import "cypress-file-upload"
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
|
||||||
@@ -17,8 +17,8 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
|||||||
cy.get("select[data-cy='ausstellgrund']")
|
cy.get("select[data-cy='ausstellgrund']")
|
||||||
.select(
|
.select(
|
||||||
faker.number.int({
|
faker.number.int({
|
||||||
min: 0,
|
min: 1,
|
||||||
max: (["Modernisierung", "Neubau", "Sonstiges", "Verkauf", "Vermietung"] as Enums.Ausstellgrund[]).length - 1,
|
max: (["Modernisierung", "Neubau", "Sonstiges", "Verkauf", "Vermietung"] as Enums.Ausstellgrund[]).length,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -40,10 +40,10 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
|||||||
{ delay: 50 }
|
{ delay: 50 }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Anzahl Einheiten
|
// // Anzahl Einheiten
|
||||||
cy.get("input[name='einheiten']")
|
// cy.get("input[name='einheiten']")
|
||||||
.should("have.attr", "type", "number")
|
// .should("have.attr", "type", "number")
|
||||||
.type(faker.number.int({ min: 1, max: 5 }).toString());
|
// .type(faker.number.int({ min: 1, max: 5 }).toString());
|
||||||
|
|
||||||
// Sanierungsstatus
|
// Sanierungsstatus
|
||||||
cy.get("select[name='saniert']").select(
|
cy.get("select[name='saniert']").select(
|
||||||
@@ -61,11 +61,12 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Ort - Dieser wird aus der Datenbank abgefragt, wir müssen also warten, bis der Dropdown da ist.
|
// TODO: Ort - Dieser wird aus der Datenbank abgefragt, wir müssen also warten, bis der Dropdown da ist.
|
||||||
|
cy.get("[data-cy='plz-container']").find("button").first().click()
|
||||||
|
|
||||||
// Flaeche
|
// // Flaeche
|
||||||
cy.get("input[name='flaeche']")
|
// cy.get("input[name='flaeche']")
|
||||||
.should("have.attr", "type", "number")
|
// .should("have.attr", "type", "number")
|
||||||
.type(faker.number.int({ min: 50, max: 1000 }).toString());
|
// .type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||||
|
|
||||||
// Nutzlaeche
|
// Nutzlaeche
|
||||||
cy.get("input[name='nutzflaeche']")
|
cy.get("input[name='nutzflaeche']")
|
||||||
@@ -90,7 +91,7 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
|||||||
cy.get("select[name='brennstoff_1']").select(brennstoffKombo[0]);
|
cy.get("select[name='brennstoff_1']").select(brennstoffKombo[0]);
|
||||||
cy.get("select[name='einheit_1']").select(brennstoffKombo[1]);
|
cy.get("select[name='einheit_1']").select(brennstoffKombo[1]);
|
||||||
|
|
||||||
let availableDates = [];
|
let availableDates = [];
|
||||||
const startDate = moment()
|
const startDate = moment()
|
||||||
.subtract(4, "years")
|
.subtract(4, "years")
|
||||||
.subtract(6, "months");
|
.subtract(6, "months");
|
||||||
@@ -104,8 +105,8 @@ let availableDates = [];
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verbrauchszeitraum
|
// Verbrauchszeitraum
|
||||||
cy.get("select[name='energieverbrauch_zeitraum_monat']").select(availableDates[0].month.toString());
|
|
||||||
cy.get("select[name='energieverbrauch_zeitraum_jahr']").select(availableDates[0].year.toString());
|
cy.get("select[name='energieverbrauch_zeitraum_jahr']").select(availableDates[0].year.toString());
|
||||||
|
cy.get("select[name='energieverbrauch_zeitraum_monat']").select(availableDates[0].month.toString());
|
||||||
|
|
||||||
// Verbrauch
|
// Verbrauch
|
||||||
cy.get("input[name='verbrauch_1']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
cy.get("input[name='verbrauch_1']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||||
@@ -261,59 +262,47 @@ let availableDates = [];
|
|||||||
// Gebäude Bild
|
// Gebäude Bild
|
||||||
cy.get("input[name='gebaeude_image']").should("have.attr", "type", "file").attachFile("images/gebaeude/1.jpeg", { subjectType: "input" });
|
cy.get("input[name='gebaeude_image']").should("have.attr", "type", "file").attachFile("images/gebaeude/1.jpeg", { subjectType: "input" });
|
||||||
|
|
||||||
// Jetzt können wir den Verbrauchsausweis erstellen.
|
cy.get("form[data-cy='ausweis'] button[data-cy='weiter']").click({ force: true });
|
||||||
cy.get("form[name='ausweis'] button[data-cy='weiter']").click({ force: true });
|
|
||||||
|
|
||||||
// Wir sind nicht eingeloggt also sollte jetzt ein Login Screen erscheinen.
|
cy.url().should("contain", "/kundendaten");
|
||||||
// Wir klicken auf registrieren und erstellen einen neuen Benutzer, danach loggen wir uns mit diesem ein.
|
|
||||||
cy.get("[data-cy='registrieren']").click();
|
|
||||||
|
|
||||||
const email = faker.internet.email();
|
const email = faker.internet.email();
|
||||||
const passwort = "test1234";
|
const passwort = "test1234";
|
||||||
const vorname = faker.person.firstName();
|
const vorname = faker.person.firstName();
|
||||||
const nachname = faker.person.lastName();
|
const nachname = faker.person.lastName();
|
||||||
|
const telefon = faker.phone.number()
|
||||||
|
|
||||||
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").type(email);
|
const strasse = faker.location.streetAddress({ useFullAddress: true })
|
||||||
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
const plz = faker.location.zipCode("#####")
|
||||||
cy.get("form[name='signup'] input[name='vorname']").should("be.visible").should("have.attr", "type", "text").type(vorname);
|
|
||||||
cy.get("form[name='signup'] input[name='nachname']").should("be.visible").should("have.attr", "type", "text").type(nachname);
|
|
||||||
|
|
||||||
cy.get("form[name='signup'] button[type='submit']").click();
|
cy.get("input[name='vorname']").should("have.attr", "type", "text").type(vorname);
|
||||||
|
cy.get("input[name='name']").should("have.attr", "type", "text").type(nachname);
|
||||||
|
cy.get("input[name='telefon']").should("have.attr", "type", "text").type(telefon);
|
||||||
|
// Rechnung
|
||||||
|
cy.get("input[name='rechnung_empfaenger']").should("have.attr", "type", "text").type(`${vorname} ${nachname}`);
|
||||||
|
cy.get("input[name='rechnung_strasse']").should("have.attr", "type", "text").type(strasse);
|
||||||
|
cy.get("input[name='rechnung_plz']").should("have.attr", "type", "text").type(plz);
|
||||||
|
cy.get("[data-cy='plz-container']").children().first().click()
|
||||||
|
cy.get("input[name='rechnung_email']").should("have.attr", "type", "email").type(email);
|
||||||
|
|
||||||
|
cy.get("[data-cy='paypal']").click()
|
||||||
|
|
||||||
|
cy.get("button[data-cy='bestellen']").click();
|
||||||
|
|
||||||
|
cy.get("a[data-cy='registrieren']").should("be.visible").click();
|
||||||
|
|
||||||
// Wir sind jetzt registriert und können uns nun einloggen.
|
// Wir sind jetzt registriert und können uns nun einloggen.
|
||||||
// Die Email sollte automatisch eingetragen sein, da wir uns gerade registriert haben.
|
// Die Email sollte automatisch eingetragen sein, da wir uns gerade registriert haben.
|
||||||
cy.get("form[name='login'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
cy.get("form[name='signup'] input[name='vorname']").should("be.visible").should("have.attr", "type", "text").type(vorname);
|
||||||
cy.get("form[name='login'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
cy.get("form[name='signup'] input[name='nachname']").should("be.visible").should("have.attr", "type", "text").type(nachname);
|
||||||
|
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
||||||
|
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
||||||
|
|
||||||
|
cy.intercept({ method: "PUT", url: "**/api/user" }).as("signup")
|
||||||
|
cy.get("form[name='signup'] button[type='submit']").click();
|
||||||
|
cy.wait("@signup")
|
||||||
cy.get("form[name='login'] button[type='submit']").click();
|
cy.get("form[name='login'] button[type='submit']").click();
|
||||||
|
|
||||||
// Der Ausweis sollte jetzt schon erstellt worden sein und wir sollten auf die kundendaten seite weitergeleitet worden sein.
|
|
||||||
cy.url().should("contain", "/kundendaten");
|
|
||||||
|
|
||||||
cy.wait(1000)
|
|
||||||
|
|
||||||
// Wir füllen jetzt die Kundendaten aus.
|
|
||||||
// cy.get("select[name='anrede']").select(Math.random() > 0.5 ? "Herr" : "Frau");
|
|
||||||
cy.get("input[name='vorname']").should("contain.value", vorname);
|
|
||||||
cy.get("input[name='name']").should("contain.value", nachname);
|
|
||||||
// cy.get("input[name='email']").should("contain.value", email);
|
|
||||||
// cy.get("input[name='telefon']").type(faker.phone.number());
|
|
||||||
|
|
||||||
cy.get("input[name='rechnung_empfaenger']").type(`${vorname} ${nachname}`);
|
|
||||||
cy.get("input[name='rechnung_strasse']").type(faker.location.streetAddress());
|
|
||||||
// TODO: Random Plz generieren, allerdings muss die auch in der Datenbank vorhanden sein...
|
|
||||||
cy.get("input[name='rechnung_plz']").type("2103");
|
|
||||||
// Jetzt sollte der PLZ Container erscheinen, dort klicken wir einfach das erste Element an.
|
|
||||||
cy.get("div[data-test='plz-container']").children().first().click();
|
|
||||||
// cy.get("input[name='rechnung_telefon']").type(faker.phone.number());
|
|
||||||
cy.get("input[name='rechnung_email']").should("contain.value", email);
|
|
||||||
cy.get("input[data-cy='paypal']").click();
|
|
||||||
|
|
||||||
// Datenschutz und AGB akzeptieren, dann schicken wir das Formular ab.
|
|
||||||
// cy.get("input[name='agb-akzeptieren']").check()
|
|
||||||
// cy.get("input[name='datenschutz-akzeptieren']").check()
|
|
||||||
cy.get("button[data-cy='bestellen']").click();
|
|
||||||
|
|
||||||
cy.origin('https://www.mollie.com', () => {
|
cy.origin('https://www.mollie.com', () => {
|
||||||
// Jetzt sind wir auf der Mollie Seite, dort wählen wir den "paid" status aus
|
// Jetzt sind wir auf der Mollie Seite, dort wählen wir den "paid" status aus
|
||||||
cy.get("input[type='radio'][name='final_state'][value='paid']").check();
|
cy.get("input[type='radio'][name='final_state'][value='paid']").check();
|
||||||
|
|||||||
282
src/cypress/e2e/VerbrauchsausweisWohnen/bearbeiten.cy.ts
Normal file
282
src/cypress/e2e/VerbrauchsausweisWohnen/bearbeiten.cy.ts
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
import fuelList from "#components/Ausweis/brennstoffListe.js";
|
||||||
|
import { faker } from "@faker-js/faker";
|
||||||
|
import "cypress-file-upload"
|
||||||
|
import moment from "moment";
|
||||||
|
import { Aufnahme, Enums, Objekt, VerbrauchsausweisWohnen } from "#lib/client/prisma.js";
|
||||||
|
|
||||||
|
describe("Verbrauchsausweis für Wohngebäude bearbeiten", async () => {
|
||||||
|
it("bearbeitet einen bereits existierenden Verbrauchsausweis für Wohngebäude", () => {
|
||||||
|
cy.task("verbrauchsausweisWohnen", {
|
||||||
|
where: {
|
||||||
|
ausgestellt: false,
|
||||||
|
bestellt: false
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
aufnahme: {
|
||||||
|
include: {
|
||||||
|
objekt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
benutzer: true
|
||||||
|
}
|
||||||
|
}).then((ausweis: VerbrauchsausweisWohnen & { aufnahme: Aufnahme & { objekt: Objekt } }) => {
|
||||||
|
cy.visit(`/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?id=${ausweis.id}`);
|
||||||
|
|
||||||
|
cy.wait(2000);
|
||||||
|
|
||||||
|
// Wir überprüfen, ob alle Ausstelgründe vorhanden sind, diese sollten genau so viele sein wie in der Datenbank vorhanden sind.
|
||||||
|
cy.get("select[data-cy='ausstellgrund']")
|
||||||
|
.find("option:selected").should("have.value", ausweis.ausstellgrund)
|
||||||
|
|
||||||
|
// Jetzt Füllen wir das Baujahr vom Gebäude aus.
|
||||||
|
cy.get("input[name='baujahr_gebaeude']")
|
||||||
|
.should("have.value", ausweis.aufnahme.baujahr_gebaeude[0])
|
||||||
|
|
||||||
|
// Jetzt Füllen wir das Baujahr der Heizung aus.
|
||||||
|
cy.get("input[name='baujahr_heizung']")
|
||||||
|
.should("have.value", ausweis.aufnahme.baujahr_heizung[0])
|
||||||
|
|
||||||
|
// Anzahl Einheiten
|
||||||
|
cy.get("input[name='einheiten']")
|
||||||
|
.should("have.value", ausweis.aufnahme.einheiten)
|
||||||
|
|
||||||
|
// Sanierungsstatus
|
||||||
|
cy.get("select[name='saniert']").find("option:selected").should("have.value", ausweis.aufnahme.saniert)
|
||||||
|
|
||||||
|
// Adresse
|
||||||
|
cy.get("input[name='adresse']").should("have.value", ausweis.aufnahme.objekt.adresse);
|
||||||
|
|
||||||
|
// Postleitzahl
|
||||||
|
cy.get("input[name='plz']").type(
|
||||||
|
faker.location.zipCode({
|
||||||
|
format: "#####",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: Ort - Dieser wird aus der Datenbank abgefragt, wir müssen also warten, bis der Dropdown da ist.
|
||||||
|
cy.get("[data-cy='plz-container']").find("button").first().click()
|
||||||
|
|
||||||
|
// Flaeche
|
||||||
|
cy.get("input[name='flaeche']")
|
||||||
|
.should("have.attr", "type", "number")
|
||||||
|
.type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||||
|
|
||||||
|
// Nutzflaeche
|
||||||
|
cy.get("input[name='nutzflaeche']")
|
||||||
|
.should("have.attr", "type", "number")
|
||||||
|
.type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||||
|
|
||||||
|
// Keller
|
||||||
|
cy.get("select[name='keller']").find("option:not([disabled])").should("have.length", (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length).parent().select(faker.number.int({
|
||||||
|
max: (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length,
|
||||||
|
min: 1
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Dachgeschoss
|
||||||
|
cy.get("select[name='dachgeschoss']").find("option:not([disabled])").should("have.length", (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length).parent().select(faker.number.int({
|
||||||
|
max: (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length,
|
||||||
|
min: 1
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Brennstoff und Einheit 1
|
||||||
|
const brennstoffKombo = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||||
|
|
||||||
|
cy.get("select[name='brennstoff_1']").select(brennstoffKombo[0]);
|
||||||
|
cy.get("select[name='einheit_1']").select(brennstoffKombo[1]);
|
||||||
|
|
||||||
|
let availableDates = [];
|
||||||
|
const startDate = moment()
|
||||||
|
.subtract(4, "years")
|
||||||
|
.subtract(6, "months");
|
||||||
|
const endDate = moment().subtract(3, "years");
|
||||||
|
|
||||||
|
for (let m = moment(startDate); m.isBefore(endDate); m.add(1, "month")) {
|
||||||
|
availableDates.push({
|
||||||
|
year: m.year(),
|
||||||
|
month: m.month(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verbrauchszeitraum
|
||||||
|
cy.get("select[name='energieverbrauch_zeitraum_jahr']").select(availableDates[0].year.toString());
|
||||||
|
cy.get("select[name='energieverbrauch_zeitraum_monat']").select(availableDates[0].month.toString());
|
||||||
|
|
||||||
|
|
||||||
|
// Verbrauch
|
||||||
|
cy.get("input[name='verbrauch_1']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
cy.get("input[name='verbrauch_2']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
cy.get("input[name='verbrauch_3']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
|
||||||
|
|
||||||
|
const zusaetzlicheHeizquelle = Math.random() > 0.5;
|
||||||
|
|
||||||
|
if (zusaetzlicheHeizquelle) {
|
||||||
|
cy.get("[data-cy='zusaetzliche_heizquelle']").check();
|
||||||
|
|
||||||
|
// Brennstoff und Einheit 2
|
||||||
|
const brennstoffKombo2 = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||||
|
|
||||||
|
cy.get("[data-cy='brennstoff_2']").select(brennstoffKombo2[0], { force: true });
|
||||||
|
cy.get("[data-cy='einheit_2']").select(brennstoffKombo2[1], { force: true });
|
||||||
|
|
||||||
|
// Verbrauch
|
||||||
|
cy.get("input[name='verbrauch_4']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
cy.get("input[name='verbrauch_5']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
cy.get("input[name='verbrauch_6']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warmwasser enthalten und bekannt
|
||||||
|
const warmwasserEnthalten = Math.random() > 0.5;
|
||||||
|
const anteilBekannt = Math.random() > 0.5;
|
||||||
|
|
||||||
|
if (warmwasserEnthalten) {
|
||||||
|
cy.get("input[name='warmwasser_enthalten']").check();
|
||||||
|
|
||||||
|
if (anteilBekannt) {
|
||||||
|
// Der Anteil ist bekannt, wir müssen ihn also angeben.
|
||||||
|
cy.get("input[name='warmwasser_anteil_bekannt']").check();
|
||||||
|
|
||||||
|
cy.get("input[name='anteil_warmwasser_1']").type(faker.number.int({ min: 0, max: 50 }).toString());
|
||||||
|
|
||||||
|
if (zusaetzlicheHeizquelle) {
|
||||||
|
// Zusätzliche Heizquelle existiert, also müssen wir auch hier den Anteil angeben.
|
||||||
|
cy.get("input[name='anteil_warmwasser_2']").type(faker.number.int({ min: 0, max: 50 }).toString(), {force: true});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternative Energieversorgungssysteme
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='alternative_heizung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='alternative_warmwasser']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='alternative_lueftung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='alternative_kuehlung']").check();
|
||||||
|
|
||||||
|
// Gebäudetyp
|
||||||
|
cy.get("select[name='gebaeudetyp']").then(($dropdown) => {
|
||||||
|
const options = $dropdown.find('option');
|
||||||
|
// Select the option at the random index
|
||||||
|
cy.get("select[name='gebaeudetyp']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gebäudeteil
|
||||||
|
cy.get("select[name='gebaeudeteil']").then(($dropdown) => {
|
||||||
|
const options = $dropdown.find('option');
|
||||||
|
// Select the option at the random index
|
||||||
|
cy.get("select[name='gebaeudeteil']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Lüftung
|
||||||
|
cy.get("select[name='lueftung']").then(($dropdown) => {
|
||||||
|
const options = $dropdown.find('option');
|
||||||
|
// Select the option at the random index
|
||||||
|
cy.get("select[name='lueftung']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Kühlung
|
||||||
|
cy.get("select[name='kuehlung']").then(($dropdown) => {
|
||||||
|
const options = $dropdown.find('option');
|
||||||
|
// Select the option at the random index
|
||||||
|
cy.get("select[name='kuehlung']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string, { force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Leerstand
|
||||||
|
cy.get("input[name='leerstand']").should("have.attr", "type", "number").type(faker.number.int({ min: 0, max: 30 }).toString());
|
||||||
|
|
||||||
|
// Heizungsanlage Daten
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='zentralheizung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='einzelofen']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='durchlauf_erhitzer']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='standard_kessel']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='solarsystem_warmwasser']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='waermepumpe']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='niedertemperatur_kessel']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='brennwert_kessel']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='warmwasser_rohre_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='heizungsrohre_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("[data-cy='zirkulation']").check();
|
||||||
|
// if (Math.random() > 0.5) cy.get("[data-cy='raum_temperatur_regler']").check();
|
||||||
|
|
||||||
|
// Heizungsanlage Bilder
|
||||||
|
cy.get("input[name='heizung_image']").should("have.attr", "type", "file").attachFile("images/heizungsanlage/1.jpeg", { subjectType: "input" });
|
||||||
|
cy.get("input[name='heizung_image']").should("have.attr", "type", "file").attachFile("images/heizungsanlage/2.jpeg", { subjectType: "input" });
|
||||||
|
|
||||||
|
// Fenster Daten
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='einfach_verglasung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='doppel_verglasung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='isolier_verglasung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='dreifach_verglasung']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='fenster_dicht']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='fenster_teilweise_undicht']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='tueren_dicht']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='tueren_undicht']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='rolllaeden_kaesten_gedaemmt']").check();
|
||||||
|
|
||||||
|
// Fenster Bilder
|
||||||
|
cy.get("input[name='fenster_image']").should("have.attr", "type", "file").attachFile("images/fenster/1.jpeg", { subjectType: "input" });
|
||||||
|
cy.get("input[name='fenster_image']").should("have.attr", "type", "file").attachFile("images/fenster/2.jpeg", { subjectType: "input" });
|
||||||
|
|
||||||
|
// Wärmedämmung Daten
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='aussenwand_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='keller_wand_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='keller_decke_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='dachgeschoss_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='oberste_geschossdecke_gedaemmt']").check();
|
||||||
|
if (Math.random() > 0.5) cy.get("input[name='oberste_geschossdecke_min_12cm_gedaemmt']").check();
|
||||||
|
|
||||||
|
// Wärmedämmung Bilder
|
||||||
|
cy.get("input[name='daemmung_image']").should("have.attr", "type", "file").attachFile("images/daemmung/1.jpeg", { subjectType: "input" });
|
||||||
|
cy.get("input[name='daemmung_image']").should("have.attr", "type", "file").attachFile("images/daemmung/2.jpeg", { subjectType: "input" });
|
||||||
|
|
||||||
|
// Gebäude Bild
|
||||||
|
cy.get("input[name='gebaeude_image']").should("have.attr", "type", "file").attachFile("images/gebaeude/1.jpeg", { subjectType: "input" });
|
||||||
|
|
||||||
|
// Jetzt können wir den Verbrauchsausweis erstellen.
|
||||||
|
cy.get("form[data-cy='ausweis'] button[data-cy='weiter']").click({ force: true });
|
||||||
|
|
||||||
|
cy.url().should("contain", "/kundendaten");
|
||||||
|
|
||||||
|
const email = faker.internet.email();
|
||||||
|
const passwort = "test1234";
|
||||||
|
const vorname = faker.person.firstName();
|
||||||
|
const nachname = faker.person.lastName();
|
||||||
|
const telefon = faker.phone.number()
|
||||||
|
|
||||||
|
const strasse = faker.location.streetAddress({ useFullAddress: true })
|
||||||
|
const plz = faker.location.zipCode("#####")
|
||||||
|
|
||||||
|
cy.get("input[name='vorname']").should("have.attr", "type", "text").type(vorname);
|
||||||
|
cy.get("input[name='name']").should("have.attr", "type", "text").type(nachname);
|
||||||
|
cy.get("input[name='telefon']").should("have.attr", "type", "text").type(telefon);
|
||||||
|
// Rechnung
|
||||||
|
cy.get("input[name='rechnung_empfaenger']").should("have.attr", "type", "text").type(`${vorname} ${nachname}`);
|
||||||
|
cy.get("input[name='rechnung_strasse']").should("have.attr", "type", "text").type(strasse);
|
||||||
|
cy.get("input[name='rechnung_plz']").should("have.attr", "type", "text").type(plz);
|
||||||
|
cy.get("[data-cy='plz-container']").children().first().click()
|
||||||
|
cy.get("input[name='rechnung_email']").should("have.attr", "type", "email").type(email);
|
||||||
|
|
||||||
|
cy.get("[data-cy='paypal']").click()
|
||||||
|
|
||||||
|
cy.get("button[data-cy='bestellen']").click();
|
||||||
|
|
||||||
|
cy.get("a[data-cy='registrieren']").should("be.visible").click();
|
||||||
|
|
||||||
|
// Wir sind jetzt registriert und können uns nun einloggen.
|
||||||
|
// Die Email sollte automatisch eingetragen sein, da wir uns gerade registriert haben.
|
||||||
|
cy.get("form[name='signup'] input[name='vorname']").should("be.visible").should("have.attr", "type", "text").type(vorname);
|
||||||
|
cy.get("form[name='signup'] input[name='nachname']").should("be.visible").should("have.attr", "type", "text").type(nachname);
|
||||||
|
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
||||||
|
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
||||||
|
|
||||||
|
cy.intercept({ method: "PUT", url: "**/api/user" }).as("signup")
|
||||||
|
cy.get("form[name='signup'] button[type='submit']").click();
|
||||||
|
cy.wait("@signup")
|
||||||
|
cy.get("form[name='login'] button[type='submit']").click();
|
||||||
|
|
||||||
|
cy.origin('https://www.mollie.com', () => {
|
||||||
|
// Jetzt sind wir auf der Mollie Seite, dort wählen wir den "paid" status aus
|
||||||
|
cy.get("input[type='radio'][name='final_state'][value='paid']").check();
|
||||||
|
// Da wird unser Test fehlschlagen, da die localhost domain von Mollie aus nicht erreichbar ist.
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -273,7 +273,9 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
|||||||
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
||||||
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
||||||
|
|
||||||
|
cy.intercept({ method: "PUT", url: "**/api/user" }).as("signup")
|
||||||
cy.get("form[name='signup'] button[type='submit']").click();
|
cy.get("form[name='signup'] button[type='submit']").click();
|
||||||
|
cy.wait("@signup")
|
||||||
cy.get("form[name='login'] button[type='submit']").click();
|
cy.get("form[name='login'] button[type='submit']").click();
|
||||||
|
|
||||||
cy.origin('https://www.mollie.com', () => {
|
cy.origin('https://www.mollie.com', () => {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
|
|
||||||
export const AnteilshaberSchema = z.object({
|
export const AnteilshaberSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
benutzer_id: z.number().int(),
|
|
||||||
rolle: z.string().nullish(),
|
rolle: z.string().nullish(),
|
||||||
privilegien: z.bigint().nullish(),
|
privilegien: z.bigint().nullish(),
|
||||||
uid: z.string(),
|
benutzer_id: z.string(),
|
||||||
objekt_id: z.number().int(),
|
objekt_id: z.string(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
|
|
||||||
export const ApiRequestsSchema = z.object({
|
export const ApiRequestsSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
date: z.date(),
|
date: z.date(),
|
||||||
ip: z.string(),
|
ip: z.string(),
|
||||||
method: z.string(),
|
method: z.string(),
|
||||||
@@ -10,5 +10,5 @@ export const ApiRequestsSchema = z.object({
|
|||||||
responseTime: z.number(),
|
responseTime: z.number(),
|
||||||
responseSize: z.number().int(),
|
responseSize: z.number().int(),
|
||||||
userAgent: z.string(),
|
userAgent: z.string(),
|
||||||
user_id: z.number().int().nullish(),
|
user_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ import * as z from "zod"
|
|||||||
import { Ausweisart, Heizungsstatus, Heizungsstatus, Lueftungskonzept } from "@prisma/client"
|
import { Ausweisart, Heizungsstatus, Heizungsstatus, Lueftungskonzept } from "@prisma/client"
|
||||||
|
|
||||||
export const AufnahmeSchema = z.object({
|
export const AufnahmeSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string().describe("UID der Gebäude Aufnahme"),
|
benutzer_id: z.string().nullish(),
|
||||||
benutzer_id: z.number().int().nullish(),
|
|
||||||
ausweisart: z.nativeEnum(Ausweisart).describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen").nullish(),
|
ausweisart: z.nativeEnum(Ausweisart).describe("Art des korrespondierenden Ausweises, wie z.B. VerbrauchsausweisWohnen").nullish(),
|
||||||
gebaeudetyp: z.string().describe("Art des Gebäudes und seiner primären Nutzungsart").nullish(),
|
gebaeudetyp: z.string().describe("Art des Gebäudes und seiner primären Nutzungsart").nullish(),
|
||||||
gebaeudeteil: z.string().describe("Betrachteter Teil des Gebäudes, z.B. Gesamtgebäude, Wohnteil, Gewerbeteil").nullish(),
|
gebaeudeteil: z.string().describe("Betrachteter Teil des Gebäudes, z.B. Gesamtgebäude, Wohnteil, Gewerbeteil").nullish(),
|
||||||
@@ -60,5 +59,5 @@ export const AufnahmeSchema = z.object({
|
|||||||
aussenwand_min_12cm_gedaemmt: z.boolean().describe("Falls die Außenwände des Gebäudes mindestens 12cm gedämmt sind, sollte dieser Wert auf true stehen").nullish(),
|
aussenwand_min_12cm_gedaemmt: z.boolean().describe("Falls die Außenwände des Gebäudes mindestens 12cm gedämmt sind, sollte dieser Wert auf true stehen").nullish(),
|
||||||
dachgeschoss_min_12cm_gedaemmt: z.boolean().describe("Falls das Dachgeschoss des Gebäudes mindestens 12cm gedämmt ist, sollte dieser Wert auf true stehen").nullish(),
|
dachgeschoss_min_12cm_gedaemmt: z.boolean().describe("Falls das Dachgeschoss des Gebäudes mindestens 12cm gedämmt ist, sollte dieser Wert auf true stehen").nullish(),
|
||||||
oberste_geschossdecke_min_12cm_gedaemmt: z.boolean().describe("Falls die oberste Geschossdecke des Gebäudes mindestens 12cm gedämmt ist, sollte dieser Wert auf true stehen").nullish(),
|
oberste_geschossdecke_min_12cm_gedaemmt: z.boolean().describe("Falls die oberste Geschossdecke des Gebäudes mindestens 12cm gedämmt ist, sollte dieser Wert auf true stehen").nullish(),
|
||||||
objekt_id: z.number().int(),
|
objekt_id: z.string(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund } from "@prisma/client"
|
import { Ausstellgrund } from "@prisma/client"
|
||||||
|
|
||||||
export const BedarfsausweisGewerbeSchema = z.object({
|
export const BedarfsausweisGewerbeSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
||||||
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
||||||
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
@@ -20,8 +19,8 @@ export const BedarfsausweisGewerbeSchema = z.object({
|
|||||||
fussbodenheizung: z.boolean().nullish(),
|
fussbodenheizung: z.boolean().nullish(),
|
||||||
bauteilaktivierung: z.boolean().nullish(),
|
bauteilaktivierung: z.boolean().nullish(),
|
||||||
klimatisierung: z.boolean().nullish(),
|
klimatisierung: z.boolean().nullish(),
|
||||||
benutzer_id: z.number().int().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
benutzer_id: z.string().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
||||||
aufnahme_id: z.number().int(),
|
aufnahme_id: z.string(),
|
||||||
rechnung_id: z.number().int().nullish(),
|
rechnung_id: z.string().nullish(),
|
||||||
geg_einpreisung_id: z.number().int().nullish(),
|
geg_einpreisung_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
||||||
|
|
||||||
export const BedarfsausweisWohnenSchema = z.object({
|
export const BedarfsausweisWohnenSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
alte_ausweis_id: z.number().int().nullish(),
|
alte_ausweis_id: z.number().int().nullish(),
|
||||||
uid: z.string(),
|
benutzer_id: z.string().nullish(),
|
||||||
benutzer_id: z.number().int().nullish(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).nullish(),
|
||||||
registriernummer: z.string().nullish(),
|
registriernummer: z.string().nullish(),
|
||||||
alternative_heizung: z.boolean().nullish(),
|
alternative_heizung: z.boolean().nullish(),
|
||||||
@@ -70,6 +69,6 @@ export const BedarfsausweisWohnenSchema = z.object({
|
|||||||
created_at: z.date(),
|
created_at: z.date(),
|
||||||
updated_at: z.date(),
|
updated_at: z.date(),
|
||||||
ausweistyp: z.nativeEnum(AusweisTyp),
|
ausweistyp: z.nativeEnum(AusweisTyp),
|
||||||
rechnung_id: z.number().int().nullish(),
|
rechnung_id: z.string().nullish(),
|
||||||
aufnahme_id: z.number().int().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
aufnahme_id: z.string().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import * as z from "zod"
|
|||||||
import { BenutzerRolle } from "@prisma/client"
|
import { BenutzerRolle } from "@prisma/client"
|
||||||
|
|
||||||
export const BenutzerSchema = z.object({
|
export const BenutzerSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
name: z.string().nullish(),
|
name: z.string().nullish(),
|
||||||
vorname: z.string().nullish(),
|
vorname: z.string().nullish(),
|
||||||
email: z.string(),
|
email: z.string(),
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ import * as z from "zod"
|
|||||||
import { BilderKategorie } from "@prisma/client"
|
import { BilderKategorie } from "@prisma/client"
|
||||||
|
|
||||||
export const BildSchema = z.object({
|
export const BildSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
kategorie: z.nativeEnum(BilderKategorie),
|
kategorie: z.nativeEnum(BilderKategorie),
|
||||||
uid: z.string(),
|
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
aufnahme_id: z.number().int().nullish(),
|
aufnahme_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export const documenttemplatesSchema = z.object({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
shortdescription: z.string(),
|
shortdescription: z.string(),
|
||||||
longdescription: z.string(),
|
longdescription: z.string(),
|
||||||
user_id: z.number().int(),
|
user_id: z.string(),
|
||||||
is_private: z.boolean(),
|
is_private: z.boolean(),
|
||||||
documenttype: z.number().int(),
|
documenttype: z.number().int(),
|
||||||
filename: z.string(),
|
filename: z.string(),
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
|
|
||||||
export const EventSchema = z.object({
|
export const EventSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
date: z.date(),
|
date: z.date(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string().nullish(),
|
description: z.string().nullish(),
|
||||||
aufnahme_id: z.number().int(),
|
aufnahme_id: z.string(),
|
||||||
benutzer_id: z.number().int().nullish(),
|
benutzer_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import * as z from "zod"
|
|||||||
import { Einpreisungsstatus } from "@prisma/client"
|
import { Einpreisungsstatus } from "@prisma/client"
|
||||||
|
|
||||||
export const GEGEinpreisungSchema = z.object({
|
export const GEGEinpreisungSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
empfaenger: z.string().nullish(),
|
empfaenger: z.string().nullish(),
|
||||||
strasse: z.string().nullish(),
|
strasse: z.string().nullish(),
|
||||||
plz: z.string().nullish(),
|
plz: z.string().nullish(),
|
||||||
@@ -18,5 +17,5 @@ export const GEGEinpreisungSchema = z.object({
|
|||||||
versand_ort: z.string().nullish(),
|
versand_ort: z.string().nullish(),
|
||||||
versand_zusatzzeile: z.string().nullish(),
|
versand_zusatzzeile: z.string().nullish(),
|
||||||
status: z.nativeEnum(Einpreisungsstatus),
|
status: z.nativeEnum(Einpreisungsstatus),
|
||||||
benutzer_id: z.number().int().describe("Die ID des Benutzers, der diese Einpreisung bekommt.").nullish(),
|
benutzer_id: z.string().describe("Die ID des Benutzers, der diese Einpreisung bekommt.").nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund } from "@prisma/client"
|
import { Ausstellgrund } from "@prisma/client"
|
||||||
|
|
||||||
export const GEGNachweisGewerbeSchema = z.object({
|
export const GEGNachweisGewerbeSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
||||||
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
||||||
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
bestellt: z.boolean().describe("Falls der Nachweis bestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
bestellt: z.boolean().describe("Falls der Nachweis bestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
zurueckgestellt: z.boolean().describe("Falls der Nachweis vom Aussteller zurückgestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
zurueckgestellt: z.boolean().describe("Falls der Nachweis vom Aussteller zurückgestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
beschreibung: z.string().describe("Beschreibung des Bauvorhabens").nullish(),
|
beschreibung: z.string().describe("Beschreibung des Bauvorhabens").nullish(),
|
||||||
benutzer_id: z.number().int().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
benutzer_id: z.string().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
||||||
aufnahme_id: z.number().int(),
|
aufnahme_id: z.string(),
|
||||||
rechnung_id: z.number().int().nullish(),
|
rechnung_id: z.string().nullish(),
|
||||||
geg_einpreisung_id: z.number().int().nullish(),
|
geg_einpreisung_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund } from "@prisma/client"
|
import { Ausstellgrund } from "@prisma/client"
|
||||||
|
|
||||||
export const GEGNachweisWohnenSchema = z.object({
|
export const GEGNachweisWohnenSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
||||||
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
keller_beheizt: z.boolean().describe("Falls der Keller des Gebäudes beheizt wird, sollte dieser Wert auf true stehen").nullish(),
|
||||||
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
storniert: z.boolean().describe("Falls die Nachweisanfrage storniert wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
bestellt: z.boolean().describe("Falls der Nachweis bestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
bestellt: z.boolean().describe("Falls der Nachweis bestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
zurueckgestellt: z.boolean().describe("Falls der Nachweis vom Aussteller zurückgestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
zurueckgestellt: z.boolean().describe("Falls der Nachweis vom Aussteller zurückgestellt wurde, sollte dieser Wert auf true stehen").nullish(),
|
||||||
beschreibung: z.string().describe("Beschreibung des Bauvorhabens").nullish(),
|
beschreibung: z.string().describe("Beschreibung des Bauvorhabens").nullish(),
|
||||||
benutzer_id: z.number().int().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
benutzer_id: z.string().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
||||||
aufnahme_id: z.number().int(),
|
aufnahme_id: z.string(),
|
||||||
rechnung_id: z.number().int().nullish(),
|
rechnung_id: z.string().nullish(),
|
||||||
geg_einpreisung_id: z.number().int().nullish(),
|
geg_einpreisung_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
export * from "./anteilshaber"
|
export * from "./anteilshaber.js"
|
||||||
export * from "./apirequests"
|
export * from "./apirequests.js"
|
||||||
export * from "./aufnahme"
|
export * from "./aufnahme.js"
|
||||||
export * from "./bedarfsausweisgewerbe"
|
export * from "./bedarfsausweisgewerbe.js"
|
||||||
export * from "./bedarfsausweiswohnen"
|
export * from "./bedarfsausweiswohnen.js"
|
||||||
export * from "./benutzer"
|
export * from "./benutzer.js"
|
||||||
export * from "./bild"
|
export * from "./bild.js"
|
||||||
export * from "./event"
|
export * from "./event.js"
|
||||||
export * from "./gegeinpreisung"
|
export * from "./gegeinpreisung.js"
|
||||||
export * from "./gegnachweisgewerbe"
|
export * from "./gegnachweisgewerbe.js"
|
||||||
export * from "./gegnachweiswohnen"
|
export * from "./gegnachweiswohnen.js"
|
||||||
export * from "./klimafaktoren"
|
export * from "./klimafaktoren.js"
|
||||||
export * from "./objekt"
|
export * from "./objekt.js"
|
||||||
export * from "./postleitzahlen"
|
export * from "./postleitzahlen.js"
|
||||||
export * from "./rechnung"
|
export * from "./rechnung.js"
|
||||||
export * from "./refreshtokens"
|
export * from "./refreshtokens.js"
|
||||||
export * from "./tickets"
|
export * from "./tickets.js"
|
||||||
export * from "./unterlage"
|
export * from "./unterlage.js"
|
||||||
export * from "./verbrauchsausweisgewerbe"
|
export * from "./verbrauchsausweisgewerbe.js"
|
||||||
export * from "./verbrauchsausweiswohnen"
|
export * from "./verbrauchsausweiswohnen.js"
|
||||||
export * from "./documenttemplates"
|
export * from "./documenttemplates.js"
|
||||||
export * from "./documenttypes"
|
export * from "./documenttypes.js"
|
||||||
export * from "./tokens"
|
export * from "./tokens.js"
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
|
|
||||||
export const ObjektSchema = z.object({
|
export const ObjektSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
benutzer_id: z.number().int().nullish(),
|
|
||||||
latitude: z.number().nullish(),
|
latitude: z.number().nullish(),
|
||||||
longitude: z.number().nullish(),
|
longitude: z.number().nullish(),
|
||||||
plz: z.string().describe("Postleitzahl des Gebäudes").nullish(),
|
plz: z.string().describe("Postleitzahl des Gebäudes").nullish(),
|
||||||
ort: z.string().describe("Ort des Gebäudes").nullish(),
|
ort: z.string().describe("Ort des Gebäudes").nullish(),
|
||||||
adresse: z.string().describe("Adresse (Straße und Hausnummer) des Gebäudes").nullish(),
|
adresse: z.string().describe("Adresse (Straße und Hausnummer) des Gebäudes").nullish(),
|
||||||
erstellungsdatum: z.date().nullish(),
|
erstellungsdatum: z.date().nullish(),
|
||||||
|
benutzer_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import * as z from "zod"
|
|||||||
import { Bezahlmethoden, Rechnungsstatus, Service } from "@prisma/client"
|
import { Bezahlmethoden, Rechnungsstatus, Service } from "@prisma/client"
|
||||||
|
|
||||||
export const RechnungSchema = z.object({
|
export const RechnungSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
benutzer_id: z.number().int(),
|
|
||||||
empfaenger: z.string().nullish(),
|
empfaenger: z.string().nullish(),
|
||||||
strasse: z.string().nullish(),
|
strasse: z.string().nullish(),
|
||||||
plz: z.string().nullish(),
|
plz: z.string().nullish(),
|
||||||
@@ -26,4 +24,5 @@ export const RechnungSchema = z.object({
|
|||||||
bezahlt_am: z.date().nullish(),
|
bezahlt_am: z.date().nullish(),
|
||||||
storniert_am: z.date().nullish(),
|
storniert_am: z.date().nullish(),
|
||||||
transaktions_referenz: z.string().nullish(),
|
transaktions_referenz: z.string().nullish(),
|
||||||
|
benutzer_id: z.string(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import * as z from "zod"
|
|||||||
|
|
||||||
export const RefreshTokensSchema = z.object({
|
export const RefreshTokensSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.number().int(),
|
||||||
benutzer_id: z.number().int(),
|
|
||||||
token: z.string(),
|
token: z.string(),
|
||||||
ip: z.string(),
|
ip: z.string(),
|
||||||
expiry: z.date(),
|
expiry: z.date(),
|
||||||
|
benutzer_id: z.string(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ const literalSchema = z.union([z.string(), z.number(), z.boolean()])
|
|||||||
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
|
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
|
||||||
|
|
||||||
export const TicketsSchema = z.object({
|
export const TicketsSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
benutzer_id: z.number().int().nullish(),
|
|
||||||
created_at: z.date(),
|
created_at: z.date(),
|
||||||
updated_at: z.date().nullish(),
|
updated_at: z.date().nullish(),
|
||||||
deleted_at: z.date().nullish(),
|
deleted_at: z.date().nullish(),
|
||||||
@@ -19,6 +17,7 @@ export const TicketsSchema = z.object({
|
|||||||
beschreibung: z.string(),
|
beschreibung: z.string(),
|
||||||
metadata: jsonSchema,
|
metadata: jsonSchema,
|
||||||
email: z.string(),
|
email: z.string(),
|
||||||
bearbeiter_id: z.number().int().nullish(),
|
bearbeiter_id: z.string().nullish(),
|
||||||
prioritaet: z.number().int().nullish(),
|
prioritaet: z.number().int().nullish(),
|
||||||
|
benutzer_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as z from "zod"
|
|||||||
export const tokensSchema = z.object({
|
export const tokensSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.number().int(),
|
||||||
token: z.string(),
|
token: z.string(),
|
||||||
user_id: z.number().int(),
|
user_id: z.string(),
|
||||||
date_created: z.date(),
|
date_created: z.date(),
|
||||||
last_used: z.date(),
|
last_used: z.date(),
|
||||||
times_used: z.number().int(),
|
times_used: z.number().int(),
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
|
|
||||||
export const UnterlageSchema = z.object({
|
export const UnterlageSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
uid: z.string(),
|
|
||||||
name: z.string().nullish(),
|
name: z.string().nullish(),
|
||||||
kategorie: z.string().nullish(),
|
kategorie: z.string().nullish(),
|
||||||
mime: z.string().nullish(),
|
mime: z.string().nullish(),
|
||||||
aufnahme_id: z.number().int().nullish(),
|
aufnahme_id: z.string().nullish(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
||||||
|
|
||||||
export const VerbrauchsausweisGewerbeSchema = z.object({
|
export const VerbrauchsausweisGewerbeSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string(),
|
||||||
alte_ausweis_id: z.number().int().nullish(),
|
alte_ausweis_id: z.number().int().nullish(),
|
||||||
uid: z.string(),
|
|
||||||
benutzer_id: z.number().int().nullish(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).nullish(),
|
||||||
registriernummer: z.string().nullish(),
|
registriernummer: z.string().nullish(),
|
||||||
zusaetzliche_heizquelle: z.boolean().nullish(),
|
zusaetzliche_heizquelle: z.boolean().nullish(),
|
||||||
@@ -51,6 +49,7 @@ export const VerbrauchsausweisGewerbeSchema = z.object({
|
|||||||
created_at: z.date(),
|
created_at: z.date(),
|
||||||
updated_at: z.date(),
|
updated_at: z.date(),
|
||||||
ausweistyp: z.nativeEnum(AusweisTyp),
|
ausweistyp: z.nativeEnum(AusweisTyp),
|
||||||
rechnung_id: z.number().int().nullish(),
|
benutzer_id: z.string().nullish(),
|
||||||
aufnahme_id: z.number().int().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
rechnung_id: z.string().nullish(),
|
||||||
|
aufnahme_id: z.string().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ import * as z from "zod"
|
|||||||
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
import { Ausstellgrund, AusweisTyp } from "@prisma/client"
|
||||||
|
|
||||||
export const VerbrauchsausweisWohnenSchema = z.object({
|
export const VerbrauchsausweisWohnenSchema = z.object({
|
||||||
id: z.number().int(),
|
id: z.string().describe("ID des Ausweises"),
|
||||||
alte_ausweis_id: z.number().int().nullish(),
|
alte_ausweis_id: z.number().int().nullish(),
|
||||||
uid: z.string().describe("UID des Ausweises"),
|
|
||||||
benutzer_id: z.number().int().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
|
||||||
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
ausstellgrund: z.nativeEnum(Ausstellgrund).describe("Ausstellgrund wie z.B. Vermietung oder Verkauf").nullish(),
|
||||||
registriernummer: z.string().describe("Die Registriernummer des Ausweises").nullish(),
|
registriernummer: z.string().describe("Die Registriernummer des Ausweises").nullish(),
|
||||||
zusaetzliche_heizquelle: z.boolean().describe("Falls eine sekundäre Heizquelle existiert, sollte dieser Wert auf true stehen").nullish(),
|
zusaetzliche_heizquelle: z.boolean().describe("Falls eine sekundäre Heizquelle existiert, sollte dieser Wert auf true stehen").nullish(),
|
||||||
@@ -38,6 +36,7 @@ export const VerbrauchsausweisWohnenSchema = z.object({
|
|||||||
ausweistyp: z.nativeEnum(AusweisTyp),
|
ausweistyp: z.nativeEnum(AusweisTyp),
|
||||||
created_at: z.date(),
|
created_at: z.date(),
|
||||||
updated_at: z.date(),
|
updated_at: z.date(),
|
||||||
rechnung_id: z.number().int().nullish(),
|
benutzer_id: z.string().describe("Die ID des Benutzers, welchem dieser Ausweis gehört").nullish(),
|
||||||
aufnahme_id: z.number().int().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
rechnung_id: z.string().nullish(),
|
||||||
|
aufnahme_id: z.string().describe("ID der korrespondierenden Gebäudeaufnahme"),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,6 +18,17 @@ const { title } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { H } from "highlight.run";
|
||||||
|
|
||||||
|
H.init("1jdkoe52", {
|
||||||
|
serviceName: "online-energieausweis",
|
||||||
|
tracingOrigins: true,
|
||||||
|
networkRecording: {
|
||||||
|
enabled: true,
|
||||||
|
recordHeadersAndBody: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
window.addEventListener("scroll", (event) => {
|
window.addEventListener("scroll", (event) => {
|
||||||
const skala = document.getElementById("skala");
|
const skala = document.getElementById("skala");
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,19 @@ export interface Props {
|
|||||||
const { title } = Astro.props;
|
const { title } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { H } from "highlight.run";
|
||||||
|
|
||||||
|
H.init("1jdkoe52", {
|
||||||
|
serviceName: "online-energieausweis",
|
||||||
|
tracingOrigins: true,
|
||||||
|
networkRecording: {
|
||||||
|
enabled: true,
|
||||||
|
recordHeadersAndBody: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|||||||
@@ -34,6 +34,19 @@ const schema = JSON.stringify({
|
|||||||
});
|
});
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { H } from "highlight.run";
|
||||||
|
|
||||||
|
H.init("1jdkoe52", {
|
||||||
|
serviceName: "online-energieausweis",
|
||||||
|
tracingOrigins: true,
|
||||||
|
networkRecording: {
|
||||||
|
enabled: true,
|
||||||
|
recordHeadersAndBody: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@@ -71,6 +71,19 @@ const schema = JSON.stringify({
|
|||||||
let lightTheme = Astro.cookies.get("theme")?.value === "light";
|
let lightTheme = Astro.cookies.get("theme")?.value === "light";
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { H } from "highlight.run";
|
||||||
|
|
||||||
|
H.init("1jdkoe52", {
|
||||||
|
serviceName: "online-energieausweis",
|
||||||
|
tracingOrigins: true,
|
||||||
|
networkRecording: {
|
||||||
|
enabled: true,
|
||||||
|
recordHeadersAndBody: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@@ -19,6 +19,17 @@ const { title } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { H } from "highlight.run";
|
||||||
|
|
||||||
|
H.init("1jdkoe52", {
|
||||||
|
serviceName: "online-energieausweis",
|
||||||
|
tracingOrigins: true,
|
||||||
|
networkRecording: {
|
||||||
|
enabled: true,
|
||||||
|
recordHeadersAndBody: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
window.addEventListener("scroll", (event) => {
|
window.addEventListener("scroll", (event) => {
|
||||||
let scroll = window.scrollY;
|
let scroll = window.scrollY;
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ export enum TokenType {
|
|||||||
Verify
|
Verify
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TokenData = { uid: string, typ: TokenType, exp: number }
|
export type TokenData = { id: string, typ: TokenType, exp: number }
|
||||||
@@ -6,22 +6,23 @@ export const API_REFRESH_TOKEN_COOKIE_NAME = "refreshToken";
|
|||||||
export const API_UID_COOKIE_NAME = "uid";
|
export const API_UID_COOKIE_NAME = "uid";
|
||||||
|
|
||||||
export enum VALID_UUID_PREFIXES {
|
export enum VALID_UUID_PREFIXES {
|
||||||
"auf" = "Aufnahme",
|
Aufnahme = "AU",
|
||||||
"obj" = "Objekt",
|
Objekt = "OB",
|
||||||
"vaw" = "Verbrauchsausweis Wohnen",
|
VerbrauchsausweisWohnen = "VW",
|
||||||
"vag" = "Verbrauchsausweis Gewerbe",
|
VerbrauchsausweisGewerbe = "VG",
|
||||||
"baw" = "Bedarfsausweis Wohnen",
|
BedarfsausweisWohnen = "BW",
|
||||||
"bag" = "Bedarfsausweis Gewerbe",
|
BedarfsausweisGewerbe = "BG",
|
||||||
"usr" = "User",
|
User = "US",
|
||||||
"ant" = "Anteilshaber",
|
Anteilshaber = "AN",
|
||||||
"evt" = "Event",
|
Event = "EV",
|
||||||
"img" = "Bild",
|
Bild = "BI",
|
||||||
"inv" = "Rechnung",
|
Rechnung = "RE",
|
||||||
"tkt" = "Ticket",
|
Ticket = "TK",
|
||||||
"pln" = "Gebäude Plan",
|
GebaeudePlan = "PN",
|
||||||
"gnw" = "GEG Nachweis Wohnen",
|
GEGNachweisWohnen = "GW",
|
||||||
"gng" = "GEG Nachweis Gewerbe",
|
GEGNachweisGewerbe = "GG",
|
||||||
"gge" = "GEG Einpreisung",
|
GEGEinpreisung = "GE",
|
||||||
|
Unterlage = "UN"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
37
src/lib/db.ts
Normal file
37
src/lib/db.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import * as crypto from "crypto";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generiert eine ID bestimmter Länge für die Datenbank, Implementierung kopiert von https://www.npmjs.com/package/crypto-random-string
|
||||||
|
* @param length Die Länge der generierten ID
|
||||||
|
* @param prefix Ein Optionales Präfix, welches vor die ID geschrieben wird, damit diese identifizierbar bleibt.
|
||||||
|
* @returns Die generierte ID
|
||||||
|
*/
|
||||||
|
export function generatePrefixedId(length: number, prefix: string = ""): string {
|
||||||
|
// Generating entropy is faster than complex math operations, so we use the simplest way
|
||||||
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"
|
||||||
|
const characterCount = characters.length;
|
||||||
|
const maxValidSelector = (Math.floor(0x1_00_00 / characterCount) * characterCount) - 1; // Using values above this will ruin distribution when using modular division
|
||||||
|
const entropyLength = 2 * Math.ceil(1.1 * length); // Generating a bit more than required so chances we need more than one pass will be really low
|
||||||
|
let string = '';
|
||||||
|
let stringLength = 0;
|
||||||
|
|
||||||
|
while (stringLength < length) { // In case we had many bad values, which may happen for character sets of size above 0x8000 but close to it
|
||||||
|
const entropy = crypto.randomBytes(entropyLength);
|
||||||
|
let entropyPosition = 0;
|
||||||
|
|
||||||
|
while (entropyPosition < entropyLength && stringLength < length) {
|
||||||
|
const entropyValue = readUInt16LE(entropy, entropyPosition);
|
||||||
|
entropyPosition += 2;
|
||||||
|
if (entropyValue > maxValidSelector) { // Skip values which will ruin distribution when using modular division
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string += characters[entropyValue % characterCount];
|
||||||
|
stringLength++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefix + string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const readUInt16LE = (uInt8Array: Buffer<ArrayBufferLike>, offset: number) => uInt8Array[offset] + (uInt8Array[offset + 1] << 8);
|
||||||
@@ -67,7 +67,7 @@ export async function checkAuthorizationHeader(authorization: string) {
|
|||||||
|
|
||||||
const user = await prisma.benutzer.findUnique({
|
const user = await prisma.benutzer.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: payload.uid
|
id: payload.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import { Enums, prisma } from "#lib/server/prisma.js";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den richtigen Prisma Adapter für die Ausweisart basierend auf der UID zurück, oder null bei einer falschen UID.
|
* Gibt den richtigen Prisma Adapter für die Ausweisart basierend auf der UID zurück, oder null bei einer falschen UID.
|
||||||
* @param uid Die Ausweis UID
|
* @param id Die Ausweis UID
|
||||||
*/
|
*/
|
||||||
export function getPrismaAusweisAdapter(uid: string) {
|
export function getPrismaAusweisAdapter(id: string) {
|
||||||
const ausweisart = getAusweisartFromUUID(uid);
|
const ausweisart = getAusweisartFromUUID(id);
|
||||||
|
|
||||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||||
return prisma.verbrauchsausweisWohnen
|
return prisma.verbrauchsausweisWohnen
|
||||||
|
|||||||
@@ -128,17 +128,17 @@
|
|||||||
|
|
||||||
const zurueck = {
|
const zurueck = {
|
||||||
[Enums.Ausweisart.VerbrauchsausweisWohnen]:
|
[Enums.Ausweisart.VerbrauchsausweisWohnen]:
|
||||||
`/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid=${ausweis.uid}`,
|
`/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid=${ausweis.id}`,
|
||||||
[Enums.Ausweisart.VerbrauchsausweisGewerbe]:
|
[Enums.Ausweisart.VerbrauchsausweisGewerbe]:
|
||||||
`/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid=${ausweis.uid}`,
|
`/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid=${ausweis.id}`,
|
||||||
[Enums.Ausweisart.BedarfsausweisWohnen]:
|
[Enums.Ausweisart.BedarfsausweisWohnen]:
|
||||||
`/energieausweis-erstellen/bedarfsausweis-wohnen?uid=${ausweis.uid}`,
|
`/energieausweis-erstellen/bedarfsausweis-wohnen?uid=${ausweis.id}`,
|
||||||
[Enums.Ausweisart.GEGNachweisWohnen]:
|
[Enums.Ausweisart.GEGNachweisWohnen]:
|
||||||
`/angebot-anfragen/geg-nachweis-wohnen-anfragen?uid=${ausweis.uid}`,
|
`/angebot-anfragen/geg-nachweis-wohnen-anfragen?uid=${ausweis.id}`,
|
||||||
[Enums.Ausweisart.GEGNachweisGewerbe]:
|
[Enums.Ausweisart.GEGNachweisGewerbe]:
|
||||||
`/angebot-anfragen/geg-nachweis-gewerbe-anfragen?uid=${ausweis.uid}`,
|
`/angebot-anfragen/geg-nachweis-gewerbe-anfragen?uid=${ausweis.id}`,
|
||||||
[Enums.Ausweisart.BedarfsausweisGewerbe]:
|
[Enums.Ausweisart.BedarfsausweisGewerbe]:
|
||||||
`/angebot-anfragen/bedarfsausweis-gewerbe-anfragen?uid=${ausweis.uid}`,
|
`/angebot-anfragen/bedarfsausweis-gewerbe-anfragen?uid=${ausweis.id}`,
|
||||||
}[ausweisart];
|
}[ausweisart];
|
||||||
|
|
||||||
async function anfordern() {
|
async function anfordern() {
|
||||||
@@ -237,11 +237,11 @@
|
|||||||
window.history.pushState(
|
window.history.pushState(
|
||||||
{},
|
{},
|
||||||
"",
|
"",
|
||||||
`${location.pathname}?uid=${ausweis.uid}`
|
`${location.pathname}?uid=${ausweis.id}`
|
||||||
);
|
);
|
||||||
|
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
window.location.href = `/speichern-erfolgreich?uid=${ausweis.uid}`
|
window.location.href = `/speichern-erfolgreich?uid=${ausweis.id}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,10 +294,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let uid: string, checkout_url: string | undefined;
|
let id: string, checkout_url: string | undefined;
|
||||||
|
|
||||||
if (rechnung) {
|
if (rechnung) {
|
||||||
const result = await api.rechnung._uid.PATCH.fetch({
|
const result = await api.rechnung._id.PATCH.fetch({
|
||||||
bezahlmethode: aktiveBezahlmethode,
|
bezahlmethode: aktiveBezahlmethode,
|
||||||
abweichende_versand_adresse: abweichende_versand_adresse,
|
abweichende_versand_adresse: abweichende_versand_adresse,
|
||||||
empfaenger: empfaenger,
|
empfaenger: empfaenger,
|
||||||
@@ -312,14 +312,14 @@
|
|||||||
versand_zusatzzeile: versand_zusatzzeile
|
versand_zusatzzeile: versand_zusatzzeile
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
uid: rechnung.uid
|
id: rechnung.id
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
uid = result.uid
|
id = result.id
|
||||||
checkout_url = result.checkout_url
|
checkout_url = result.checkout_url
|
||||||
} else {
|
} else {
|
||||||
const result = await api.rechnung.PUT.fetch(
|
const result = await api.rechnung.PUT.fetch(
|
||||||
@@ -339,7 +339,7 @@
|
|||||||
versand_plz: versand_plz,
|
versand_plz: versand_plz,
|
||||||
versand_ort: versand_ort,
|
versand_ort: versand_ort,
|
||||||
telefon: telefon,
|
telefon: telefon,
|
||||||
ausweis_uid: ausweis.uid
|
ausweis_id: ausweis.id
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
@@ -348,7 +348,7 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
uid = result.uid;
|
id = result.id;
|
||||||
checkout_url = result.checkout_url;
|
checkout_url = result.checkout_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@
|
|||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
|
||||||
if (aktiveBezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
if (aktiveBezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||||
window.location.href = `/payment/success?r=${uid}&a=${ausweis.uid}`;
|
window.location.href = `/payment/success?r=${id}&a=${ausweis.id}`;
|
||||||
} else {
|
} else {
|
||||||
window.location.href = checkout_url as string;
|
window.location.href = checkout_url as string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const PUT = defineApiRoute({
|
|||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid
|
id: ctx.params.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -24,10 +24,10 @@ export const PUT = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
prisma.$transaction(async tx => {
|
prisma.$transaction(async tx => {
|
||||||
for (const uid of input) {
|
for (const id of input) {
|
||||||
const img = await tx.bild.findUnique({
|
const img = await tx.bild.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -39,14 +39,14 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
await tx.bild.update({
|
await tx.bild.update({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
aufnahme_id: null
|
aufnahme_id: null
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
aufnahme_id: aufnahme.id
|
aufnahme_id: aufnahme.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -58,22 +58,22 @@ export const GET = defineApiRoute({
|
|||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
output: z.array(BildSchema.pick({
|
output: z.array(BildSchema.pick({
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true
|
id: true
|
||||||
})),
|
})),
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
} : { uid },
|
} : { id },
|
||||||
select: {
|
select: {
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
bilder: {
|
bilder: {
|
||||||
select: {
|
select: {
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import { z } from "zod";
|
|||||||
export const PATCH = defineApiRoute({
|
export const PATCH = defineApiRoute({
|
||||||
input: AufnahmeSchema.omit({
|
input: AufnahmeSchema.omit({
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
objekt_id: true,
|
objekt_id: true,
|
||||||
erstellungsdatum: true
|
erstellungsdatum: true
|
||||||
@@ -17,11 +16,11 @@ export const PATCH = defineApiRoute({
|
|||||||
output: z.void(),
|
output: z.void(),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params
|
const { id } = ctx.params
|
||||||
|
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -35,7 +34,7 @@ export const PATCH = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.aufnahme.update({
|
await prisma.aufnahme.update({
|
||||||
where: {
|
where: {
|
||||||
uid
|
id
|
||||||
},
|
},
|
||||||
data: input
|
data: input
|
||||||
})
|
})
|
||||||
@@ -59,26 +58,20 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
output: ZodOverlap<OptionalNullable<AufnahmeClient>>(AufnahmeSchema.omit({
|
output: ZodOverlap<OptionalNullable<AufnahmeClient>>(AufnahmeSchema),
|
||||||
id: true,
|
|
||||||
objekt_id: true,
|
|
||||||
benutzer_id: true
|
|
||||||
}).merge(z.object({
|
|
||||||
uid_objekt: UUidWithPrefix
|
|
||||||
}))),
|
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const { uid } = context.params;
|
const { id } = context.params;
|
||||||
|
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
} : { uid },
|
} : { id },
|
||||||
include: {
|
include: {
|
||||||
objekt: {
|
objekt: {
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,8 +85,7 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return exclude({
|
return exclude({
|
||||||
uid_objekt: aufnahme.objekt.uid,
|
|
||||||
...aufnahme
|
...aufnahme
|
||||||
}, ["id", "objekt_id", "benutzer_id", "objekt"])
|
}, ["objekt"])
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { prisma, UnterlageSchema } from "#lib/server/prisma";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { UnterlageSchema } from "src/generated/zod/unterlage.js";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
input: z.array(UUidWithPrefix),
|
input: z.array(UUidWithPrefix),
|
||||||
@@ -11,7 +12,7 @@ export const PUT = defineApiRoute({
|
|||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid
|
id: ctx.params.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -23,17 +24,17 @@ export const PUT = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
prisma.$transaction(async tx => {
|
prisma.$transaction(async tx => {
|
||||||
for (const uid of input) {
|
for (const id of input) {
|
||||||
const img = await tx.unterlage.update({
|
const img = await tx.unterlage.update({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
aufnahme_id: null
|
aufnahme_id: null
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
aufnahme_id: aufnahme.id
|
aufnahme_id: aufnahme.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -52,14 +53,14 @@ export const GET = defineApiRoute({
|
|||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
output: z.array(UnterlageSchema.pick({
|
output: z.array(UnterlageSchema.pick({
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true
|
id: true
|
||||||
})),
|
})),
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@@ -67,7 +68,7 @@ export const GET = defineApiRoute({
|
|||||||
unterlagen: {
|
unterlagen: {
|
||||||
select: {
|
select: {
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true,
|
id: true,
|
||||||
mime: true,
|
mime: true,
|
||||||
name: true
|
name: true
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js"
|
import { UUidWithPrefix } from "#components/Ausweis/types.js"
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js"
|
||||||
|
import { generatePrefixedId } from "#lib/db.js"
|
||||||
import { authorizationMiddleware } from "#lib/middleware/authorization.js"
|
import { authorizationMiddleware } from "#lib/middleware/authorization.js"
|
||||||
import { prisma } from "#lib/server/prisma.js"
|
import { prisma } from "#lib/server/prisma.js"
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server"
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server"
|
||||||
@@ -9,22 +11,21 @@ export const PUT = defineApiRoute({
|
|||||||
input: z.object({
|
input: z.object({
|
||||||
aufnahme: AufnahmeSchema.omit({
|
aufnahme: AufnahmeSchema.omit({
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
objekt_id: true,
|
objekt_id: true,
|
||||||
}).merge(z.object({
|
}).merge(z.object({
|
||||||
baujahr_klima: z.array(z.number().int().positive()).optional()
|
baujahr_klima: z.array(z.number().int().positive()).optional()
|
||||||
})),
|
})),
|
||||||
uid_objekt: UUidWithPrefix
|
objekt_id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix
|
id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const objekt = await prisma.objekt.findUnique({
|
const objekt = await prisma.objekt.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid_objekt,
|
id: input.objekt_id,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
}
|
}
|
||||||
@@ -38,8 +39,11 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.Aufnahme)
|
||||||
|
|
||||||
const aufnahme = await prisma.aufnahme.create({
|
const aufnahme = await prisma.aufnahme.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
...input.aufnahme,
|
...input.aufnahme,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
connect: {
|
connect: {
|
||||||
@@ -48,14 +52,14 @@ export const PUT = defineApiRoute({
|
|||||||
},
|
},
|
||||||
objekt: {
|
objekt: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: input.uid_objekt
|
id: input.objekt_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: aufnahme.uid
|
id: aufnahme.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -92,7 +92,7 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
const refreshTokenExpiry = moment().add(30, "days");
|
const refreshTokenExpiry = moment().add(30, "days");
|
||||||
const refreshToken = encodeToken({
|
const refreshToken = encodeToken({
|
||||||
uid: user.uid,
|
id: user.id,
|
||||||
typ: TokenType.Refresh,
|
typ: TokenType.Refresh,
|
||||||
exp: refreshTokenExpiry.valueOf(),
|
exp: refreshTokenExpiry.valueOf(),
|
||||||
});
|
});
|
||||||
@@ -109,7 +109,7 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
const accessTokenExpiry = moment().add(2, "days").valueOf();
|
const accessTokenExpiry = moment().add(2, "days").valueOf();
|
||||||
const accessToken = encodeToken({
|
const accessToken = encodeToken({
|
||||||
uid: user.uid,
|
id: user.id,
|
||||||
typ: TokenType.Access,
|
typ: TokenType.Access,
|
||||||
exp: accessTokenExpiry,
|
exp: accessTokenExpiry,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const GET = defineApiRoute({
|
|||||||
passwort: z.string().min(8).max(100),
|
passwort: z.string().min(8).max(100),
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix,
|
id: UUidWithPrefix,
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
refreshToken: z.string(),
|
refreshToken: z.string(),
|
||||||
refreshTokenBase64: z.string(),
|
refreshTokenBase64: z.string(),
|
||||||
@@ -51,12 +51,12 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
const refreshTokenExpiry = moment().add(30, "days");
|
const refreshTokenExpiry = moment().add(30, "days");
|
||||||
const accessToken = encodeToken({
|
const accessToken = encodeToken({
|
||||||
uid: user.uid,
|
id: user.id,
|
||||||
typ: TokenType.Access,
|
typ: TokenType.Access,
|
||||||
exp: moment().add(30, "minutes").valueOf(),
|
exp: moment().add(30, "minutes").valueOf(),
|
||||||
});
|
});
|
||||||
const refreshToken = encodeToken({
|
const refreshToken = encodeToken({
|
||||||
uid: user.uid,
|
id: user.id,
|
||||||
typ: TokenType.Refresh,
|
typ: TokenType.Refresh,
|
||||||
exp: refreshTokenExpiry.valueOf(),
|
exp: refreshTokenExpiry.valueOf(),
|
||||||
});
|
});
|
||||||
@@ -71,7 +71,7 @@ export const GET = defineApiRoute({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: user.uid,
|
id: user.id,
|
||||||
accessToken,
|
accessToken,
|
||||||
refreshToken,
|
refreshToken,
|
||||||
refreshTokenBase64: Buffer.from(refreshToken).toString("base64"),
|
refreshTokenBase64: Buffer.from(refreshToken).toString("base64"),
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { authorizationMiddleware, maybeAuthorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { maybeAuthorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { defineApiRoute, APIError } from "astro-typesafe-api/server";
|
import { defineApiRoute, APIError } from "astro-typesafe-api/server";
|
||||||
import { z } from "astro:content";
|
import { z } from "astro:content";
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import isBase64 from "is-base64";
|
import isBase64 from "is-base64";
|
||||||
import { writeFileSync } from "fs"
|
|
||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
import { BildSchema } from "src/generated/zod/bild.js";
|
import { BildSchema } from "src/generated/zod/bild.js";
|
||||||
import sharp from "sharp"
|
import sharp from "sharp"
|
||||||
import { PERSISTENT_DIR } from "#lib/server/constants.js";
|
import { PutObjectCommand } from "@aws-sdk/client-s3";
|
||||||
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
||||||
import { s3Client } from "#lib/s3.js";
|
import { s3Client } from "#lib/s3.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
input: BildSchema.pick({
|
input: BildSchema.pick({
|
||||||
@@ -20,7 +19,7 @@ export const PUT = defineApiRoute({
|
|||||||
data: z.string()
|
data: z.string()
|
||||||
})),
|
})),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: z.string({ description: "Die UID des Bildes." })
|
id: z.string({ description: "Die id des Bildes." })
|
||||||
}),
|
}),
|
||||||
async fetch(input) {
|
async fetch(input) {
|
||||||
const data = input.data;
|
const data = input.data;
|
||||||
@@ -38,14 +37,14 @@ export const PUT = defineApiRoute({
|
|||||||
);
|
);
|
||||||
const buffer = Buffer.from(dataWithoutPrefix, "base64");
|
const buffer = Buffer.from(dataWithoutPrefix, "base64");
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.Bild)
|
||||||
|
|
||||||
const bild = await prisma.bild.create({
|
const bild = await prisma.bild.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
kategorie: input.kategorie,
|
kategorie: input.kategorie,
|
||||||
name: input.name
|
name: input.name
|
||||||
},
|
}
|
||||||
select: {
|
|
||||||
uid: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
const command = new PutObjectCommand({
|
const command = new PutObjectCommand({
|
||||||
Bucket: "ibc-images",
|
Bucket: "ibc-images",
|
||||||
Key: `${bild.uid}.jpg`,
|
Key: `${id}.jpg`,
|
||||||
Body: optimizedBuffer,
|
Body: optimizedBuffer,
|
||||||
ACL: "private"
|
ACL: "private"
|
||||||
})
|
})
|
||||||
@@ -67,7 +66,7 @@ export const PUT = defineApiRoute({
|
|||||||
// Bild wurde nicht gespeichert, wir löschen den Eintrag wieder
|
// Bild wurde nicht gespeichert, wir löschen den Eintrag wieder
|
||||||
await prisma.bild.delete({
|
await prisma.bild.delete({
|
||||||
where: {
|
where: {
|
||||||
uid: bild.uid
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Und geben einen Fehler zurück
|
// Und geben einen Fehler zurück
|
||||||
@@ -78,14 +77,14 @@ export const PUT = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: bild.uid
|
id
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const DELETE = defineApiRoute({
|
export const DELETE = defineApiRoute({
|
||||||
input: z.object({
|
input: z.object({
|
||||||
uid: UUidWithPrefix
|
id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
middleware: maybeAuthorizationMiddleware,
|
middleware: maybeAuthorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
@@ -93,7 +92,7 @@ export const DELETE = defineApiRoute({
|
|||||||
if (user) {
|
if (user) {
|
||||||
await prisma.bild.delete({
|
await prisma.bild.delete({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid,
|
id: input.id,
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
@@ -104,7 +103,7 @@ export const DELETE = defineApiRoute({
|
|||||||
} else {
|
} else {
|
||||||
await prisma.bild.delete({
|
await prisma.bild.delete({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid,
|
id: input.id,
|
||||||
aufnahme_id: null
|
aufnahme_id: null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const PATCH = defineApiRoute({
|
|||||||
|
|
||||||
const image = await prisma.bild.findUnique({
|
const image = await prisma.bild.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid,
|
id: ctx.params.id,
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ export const PATCH = defineApiRoute({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const filePath = fileURLToPath(new URL(`${PERSISTENT_DIR}/images/${image.uid}.jpg`, import.meta.url));
|
const filePath = fileURLToPath(new URL(`${PERSISTENT_DIR}/images/${image.id}.jpg`, import.meta.url));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Wir optimieren das Bild und konvertieren es in WebP
|
// Wir optimieren das Bild und konvertieren es in WebP
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { ObjektClient, OptionalNullable, ZodOverlap } from "#components/Ausweis/types.js";
|
import { ObjektClient, OptionalNullable, ZodOverlap } from "#components/Ausweis/types.js";
|
||||||
import { exclude } from "#lib/exclude.js";
|
import { exclude } from "#lib/exclude.js";
|
||||||
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { Enums, ObjektSchema, prisma } from "#lib/server/prisma.js";
|
import { Enums, prisma } from "#lib/server/prisma.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
|
import { ObjektSchema } from "src/generated/zod/objekt.js";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const PATCH = defineApiRoute({
|
export const PATCH = defineApiRoute({
|
||||||
input: ObjektSchema.omit({
|
input: ObjektSchema.omit({
|
||||||
uid: true,
|
|
||||||
id: true,
|
id: true,
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
erstellungsdatum: true
|
erstellungsdatum: true
|
||||||
@@ -20,7 +20,7 @@ export const PATCH = defineApiRoute({
|
|||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const objekt = await prisma.objekt.findUnique({
|
const objekt = await prisma.objekt.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid,
|
id: ctx.params.id,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ export const PATCH = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.objekt.update({
|
await prisma.objekt.update({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid
|
id: ctx.params.id
|
||||||
},
|
},
|
||||||
data: input
|
data: input
|
||||||
})
|
})
|
||||||
@@ -66,13 +66,13 @@ export const GET = defineApiRoute({
|
|||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
const objekt = await prisma.objekt.findUnique({
|
const objekt = await prisma.objekt.findUnique({
|
||||||
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
} : { uid },
|
} : { id },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!objekt) {
|
if (!objekt) {
|
||||||
@@ -1,24 +1,30 @@
|
|||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { defineApiRoute } from "astro-typesafe-api/server";
|
import { defineApiRoute } from "astro-typesafe-api/server";
|
||||||
import { ObjektSchema } from "src/generated/zod/index.js";
|
import { ObjektSchema } from "src/generated/zod/objekt.js";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
input: ObjektSchema.omit({
|
input: ObjektSchema.omit({
|
||||||
id: true,
|
id: true,
|
||||||
uid: true,
|
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
erstellungsdatum: true
|
erstellungsdatum: true
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix
|
id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
|
const id = generatePrefixedId(6, "OB")
|
||||||
|
|
||||||
|
console.log(id);
|
||||||
|
|
||||||
|
|
||||||
const objekt = await prisma.objekt.create({
|
const objekt = await prisma.objekt.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
...input,
|
...input,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
connect: {
|
connect: {
|
||||||
@@ -29,7 +35,7 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: objekt.uid
|
id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const PATCH = defineApiRoute({
|
|||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
checkout_url: z.string().optional(),
|
checkout_url: z.string().optional(),
|
||||||
uid: UUidWithPrefix,
|
id: UUidWithPrefix,
|
||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
@@ -33,7 +33,7 @@ export const PATCH = defineApiRoute({
|
|||||||
// Wir holen uns die Rechnung
|
// Wir holen uns die Rechnung
|
||||||
const rechnung = await prisma.rechnung.findUnique({
|
const rechnung = await prisma.rechnung.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: context.params.uid,
|
id: context.params.id,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ export const PATCH = defineApiRoute({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (input.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
if (input.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||||
return { uid: rechnung.uid }
|
return { id: rechnung.id }
|
||||||
}
|
}
|
||||||
|
|
||||||
const ausweis = rechnung.verbrauchsausweis_gewerbe || rechnung.verbrauchsausweis_wohnen || rechnung.bedarfsausweis_gewerbe || rechnung.bedarfsausweis_wohnen || rechnung.geg_nachweis_gewerbe || rechnung.geg_nachweis_wohnen;
|
const ausweis = rechnung.verbrauchsausweis_gewerbe || rechnung.verbrauchsausweis_wohnen || rechnung.bedarfsausweis_gewerbe || rechnung.bedarfsausweis_wohnen || rechnung.geg_nachweis_gewerbe || rechnung.geg_nachweis_wohnen;
|
||||||
@@ -88,7 +88,7 @@ export const PATCH = defineApiRoute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const ausweisart = getAusweisartFromUUID(ausweis.uid)
|
const ausweisart = getAusweisartFromUUID(ausweis.id)
|
||||||
|
|
||||||
if (!ausweisart) {
|
if (!ausweisart) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
@@ -106,12 +106,12 @@ export const PATCH = defineApiRoute({
|
|||||||
currency: "EUR",
|
currency: "EUR",
|
||||||
},
|
},
|
||||||
metadata: {
|
metadata: {
|
||||||
rechnung_uid: rechnung.uid,
|
rechnung_id: rechnung.id,
|
||||||
},
|
},
|
||||||
method: input.bezahlmethode as PaymentMethod,
|
method: input.bezahlmethode as PaymentMethod,
|
||||||
description,
|
description,
|
||||||
redirectUrl: `https://ibcornelsen.de/payment/success?a=${ausweis.uid}&r=${rechnung.uid}`,
|
redirectUrl: `https://ibcornelsen.de/payment/success?a=${ausweis.id}&r=${rechnung.id}`,
|
||||||
webhookUrl: `http://ibcornelsen.de/api/webhooks/mollie?uid=${rechnung.uid}`,
|
webhookUrl: `http://ibcornelsen.de/api/webhooks/mollie?uid=${rechnung.id}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkoutUrl = payment.getCheckoutUrl();
|
const checkoutUrl = payment.getCheckoutUrl();
|
||||||
@@ -124,7 +124,7 @@ export const PATCH = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: rechnung.uid,
|
id: rechnung.id,
|
||||||
checkout_url: checkoutUrl,
|
checkout_url: checkoutUrl,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -9,9 +9,10 @@ import {
|
|||||||
} from "#lib/middleware/authorization.js";
|
} from "#lib/middleware/authorization.js";
|
||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
import { getPrismaAusweisAdapter } from "#lib/server/ausweis.js";
|
import { getPrismaAusweisAdapter } from "#lib/server/ausweis.js";
|
||||||
import { PRICES, SERVICES } from "#lib/constants.js";
|
import { PRICES, SERVICES, VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
import { Rechnung } from "#lib/client/prisma.js";
|
import { Rechnung } from "#lib/client/prisma.js";
|
||||||
import { RechnungSchema } from "src/generated/zod/rechnung.js";
|
import { RechnungSchema } from "src/generated/zod/rechnung.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
meta: {
|
meta: {
|
||||||
@@ -24,7 +25,7 @@ export const PUT = defineApiRoute({
|
|||||||
input: z
|
input: z
|
||||||
.object({
|
.object({
|
||||||
ausweisart: z.nativeEnum(Enums.Ausweisart),
|
ausweisart: z.nativeEnum(Enums.Ausweisart),
|
||||||
ausweis_uid: UUidWithPrefix,
|
ausweis_id: UUidWithPrefix,
|
||||||
})
|
})
|
||||||
.merge(
|
.merge(
|
||||||
RechnungSchema.omit({
|
RechnungSchema.omit({
|
||||||
@@ -33,7 +34,6 @@ export const PUT = defineApiRoute({
|
|||||||
erstellt_am: true,
|
erstellt_am: true,
|
||||||
id: true,
|
id: true,
|
||||||
status: true,
|
status: true,
|
||||||
uid: true,
|
|
||||||
betrag: true,
|
betrag: true,
|
||||||
storniert_am: true,
|
storniert_am: true,
|
||||||
transaktions_referenz: true,
|
transaktions_referenz: true,
|
||||||
@@ -41,7 +41,7 @@ export const PUT = defineApiRoute({
|
|||||||
),
|
),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
checkout_url: z.string().optional(),
|
checkout_url: z.string().optional(),
|
||||||
uid: UUidWithPrefix,
|
id: UUidWithPrefix,
|
||||||
}),
|
}),
|
||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
@@ -49,9 +49,9 @@ export const PUT = defineApiRoute({
|
|||||||
// Wir erstellen eine Mollie Payment Referenz und eine neue Rechnung in unserer Datenbank, daraufhin geben
|
// Wir erstellen eine Mollie Payment Referenz und eine neue Rechnung in unserer Datenbank, daraufhin geben
|
||||||
// wir eine Checkout URL zurück auf die der Nutzer weitergeleitet werden kann.
|
// wir eine Checkout URL zurück auf die der Nutzer weitergeleitet werden kann.
|
||||||
|
|
||||||
const { ausweis_uid, ausweisart, bezahlmethode, services } = input;
|
const { ausweis_id, ausweisart, bezahlmethode, services } = input;
|
||||||
|
|
||||||
const adapter = getPrismaAusweisAdapter(ausweis_uid);
|
const adapter = getPrismaAusweisAdapter(ausweis_id);
|
||||||
|
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
@@ -62,7 +62,7 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
const ausweis = await adapter.findUnique({
|
const ausweis = await adapter.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ausweis_uid
|
id: ausweis_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -87,18 +87,21 @@ export const PUT = defineApiRoute({
|
|||||||
betrag += servicePriceList[service]
|
betrag += servicePriceList[service]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.Rechnung);
|
||||||
|
|
||||||
// Wir erstellen eine neue Rechnung in unserer Datenbank.
|
// Wir erstellen eine neue Rechnung in unserer Datenbank.
|
||||||
let rechnung: Rechnung | null = null;
|
let rechnung: Rechnung | null = null;
|
||||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||||
rechnung = await prisma.rechnung.create({
|
rechnung = await prisma.rechnung.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
benutzer_id: user.id,
|
benutzer_id: user.id,
|
||||||
betrag,
|
betrag,
|
||||||
bezahlmethode: bezahlmethode,
|
bezahlmethode: bezahlmethode,
|
||||||
status: Enums.Rechnungsstatus.open,
|
status: Enums.Rechnungsstatus.open,
|
||||||
verbrauchsausweis_wohnen: {
|
verbrauchsausweis_wohnen: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: ausweis_uid
|
id: ausweis_id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
services,
|
services,
|
||||||
@@ -107,13 +110,14 @@ export const PUT = defineApiRoute({
|
|||||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||||
rechnung = await prisma.rechnung.create({
|
rechnung = await prisma.rechnung.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
benutzer_id: user.id,
|
benutzer_id: user.id,
|
||||||
betrag,
|
betrag,
|
||||||
bezahlmethode: bezahlmethode,
|
bezahlmethode: bezahlmethode,
|
||||||
status: Enums.Rechnungsstatus.open,
|
status: Enums.Rechnungsstatus.open,
|
||||||
verbrauchsausweis_gewerbe: {
|
verbrauchsausweis_gewerbe: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: ausweis_uid
|
id: ausweis_id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
services,
|
services,
|
||||||
@@ -122,13 +126,14 @@ export const PUT = defineApiRoute({
|
|||||||
} else if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
|
} else if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||||
rechnung = await prisma.rechnung.create({
|
rechnung = await prisma.rechnung.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
benutzer_id: user.id,
|
benutzer_id: user.id,
|
||||||
betrag,
|
betrag,
|
||||||
bezahlmethode: bezahlmethode,
|
bezahlmethode: bezahlmethode,
|
||||||
status: Enums.Rechnungsstatus.open,
|
status: Enums.Rechnungsstatus.open,
|
||||||
bedarfsausweis_wohnen: {
|
bedarfsausweis_wohnen: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: ausweis_uid
|
id: ausweis_id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
services,
|
services,
|
||||||
@@ -145,7 +150,7 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
await adapter.update({
|
await adapter.update({
|
||||||
where: {
|
where: {
|
||||||
uid: ausweis_uid
|
id: ausweis_id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
bestellt: true
|
bestellt: true
|
||||||
@@ -153,7 +158,7 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||||
return { uid: rechnung.uid }
|
return { id }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wir erstellen eine Mollie Payment Referenz.
|
// Wir erstellen eine Mollie Payment Referenz.
|
||||||
@@ -163,12 +168,12 @@ export const PUT = defineApiRoute({
|
|||||||
currency: "EUR",
|
currency: "EUR",
|
||||||
},
|
},
|
||||||
metadata: {
|
metadata: {
|
||||||
rechnung_uid: rechnung.uid,
|
rechnung_id: rechnung.id,
|
||||||
},
|
},
|
||||||
method: input.bezahlmethode as PaymentMethod,
|
method: input.bezahlmethode as PaymentMethod,
|
||||||
description: "Verbrauchsausweis Wohnen 2016",
|
description: "Verbrauchsausweis Wohnen 2016",
|
||||||
redirectUrl: `https://ibcornelsen.de/payment/success?a=${ausweis.uid}&r=${rechnung.uid}`,
|
redirectUrl: `https://ibcornelsen.de/payment/success?a=${ausweis.id}&r=${rechnung.id}`,
|
||||||
webhookUrl: `http://ibcornelsen.de/api/webhooks/mollie?uid=${rechnung.uid}`,
|
webhookUrl: `http://ibcornelsen.de/api/webhooks/mollie?uid=${rechnung.id}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkoutUrl = payment.getCheckoutUrl();
|
const checkoutUrl = payment.getCheckoutUrl();
|
||||||
@@ -181,7 +186,7 @@ export const PUT = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: rechnung.uid,
|
id,
|
||||||
checkout_url: checkoutUrl,
|
checkout_url: checkoutUrl,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,17 +6,19 @@ import { fileURLToPath } from "url";
|
|||||||
import { writeFileSync } from "fs";
|
import { writeFileSync } from "fs";
|
||||||
import { PERSISTENT_DIR } from "#lib/server/constants.js";
|
import { PERSISTENT_DIR } from "#lib/server/constants.js";
|
||||||
import { UnterlageSchema } from "src/generated/zod/unterlage.js";
|
import { UnterlageSchema } from "src/generated/zod/unterlage.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
|
||||||
export const PUT = defineApiRoute({
|
export const PUT = defineApiRoute({
|
||||||
input: UnterlageSchema.omit({
|
input: UnterlageSchema.omit({
|
||||||
aufnahme_id: true,
|
aufnahme_id: true,
|
||||||
id: true,
|
id: true,
|
||||||
uid: true
|
|
||||||
}).merge(z.object({
|
}).merge(z.object({
|
||||||
data: z.string(),
|
data: z.string(),
|
||||||
})),
|
})),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: z.string({ description: "Die UID der Unterlage." })
|
id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
async fetch({ data, name, kategorie, mime }, ctx, user) {
|
async fetch({ data, name, kategorie, mime }, ctx, user) {
|
||||||
if (mime !== "application/pdf" && mime !== "image/png" && mime !== "image/jpeg") {
|
if (mime !== "application/pdf" && mime !== "image/png" && mime !== "image/jpeg") {
|
||||||
@@ -28,18 +30,18 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
const buffer = Buffer.from(data, "base64");
|
const buffer = Buffer.from(data, "base64");
|
||||||
|
|
||||||
const unterlage = await prisma.unterlage.create({
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.Unterlage)
|
||||||
|
|
||||||
|
await prisma.unterlage.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
kategorie: kategorie,
|
kategorie: kategorie,
|
||||||
mime,
|
mime,
|
||||||
name
|
name
|
||||||
},
|
}
|
||||||
select: {
|
|
||||||
uid: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const filePath = fileURLToPath(new URL(`${PERSISTENT_DIR}/unterlagen/${unterlage.uid}`, import.meta.url));
|
const filePath = fileURLToPath(new URL(`${PERSISTENT_DIR}/unterlagen/${id}`, import.meta.url));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
writeFileSync(filePath, buffer)
|
writeFileSync(filePath, buffer)
|
||||||
@@ -47,7 +49,7 @@ export const PUT = defineApiRoute({
|
|||||||
// Unterlage wurde nicht gespeichert, wir löschen den Eintrag wieder
|
// Unterlage wurde nicht gespeichert, wir löschen den Eintrag wieder
|
||||||
await prisma.unterlage.delete({
|
await prisma.unterlage.delete({
|
||||||
where: {
|
where: {
|
||||||
uid: unterlage.uid
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Und geben einen Fehler zurück
|
// Und geben einen Fehler zurück
|
||||||
@@ -58,7 +60,7 @@ export const PUT = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: unterlage.uid
|
id
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -67,14 +69,14 @@ export const GET = defineApiRoute({
|
|||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
output: z.array(UnterlageSchema.pick({
|
output: z.array(UnterlageSchema.pick({
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true
|
id: true
|
||||||
})),
|
})),
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
const objekt = await prisma.aufnahme.findUnique({
|
const objekt = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@@ -82,7 +84,7 @@ export const GET = defineApiRoute({
|
|||||||
unterlagen: {
|
unterlagen: {
|
||||||
select: {
|
select: {
|
||||||
kategorie: true,
|
kategorie: true,
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { adminMiddleware, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { adminMiddleware, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { hashPassword } from "#lib/password.js";
|
import { hashPassword } from "#lib/password.js";
|
||||||
import { sendRegisterMail } from "#lib/server/mail/registrierung.js";
|
import { sendRegisterMail } from "#lib/server/mail/registrierung.js";
|
||||||
@@ -11,7 +13,6 @@ export const POST = defineApiRoute({
|
|||||||
input: BenutzerSchema.omit({
|
input: BenutzerSchema.omit({
|
||||||
id: true,
|
id: true,
|
||||||
lex_office_id: true,
|
lex_office_id: true,
|
||||||
uid: true,
|
|
||||||
rolle: true
|
rolle: true
|
||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
@@ -43,7 +44,7 @@ export const POST = defineApiRoute({
|
|||||||
|
|
||||||
export const GET = defineApiRoute({
|
export const GET = defineApiRoute({
|
||||||
input: z.object({
|
input: z.object({
|
||||||
uid: UUidWithPrefix
|
id: UUidWithPrefix
|
||||||
}).or(z.object({
|
}).or(z.object({
|
||||||
take: z.number(),
|
take: z.number(),
|
||||||
email: z.string()
|
email: z.string()
|
||||||
@@ -51,13 +52,17 @@ export const GET = defineApiRoute({
|
|||||||
output: z.array(BenutzerSchema),
|
output: z.array(BenutzerSchema),
|
||||||
middleware: adminMiddleware,
|
middleware: adminMiddleware,
|
||||||
async fetch(input, context, admin) {
|
async fetch(input, context, admin) {
|
||||||
if ("uid" in input) {
|
if ("id" in input) {
|
||||||
const user = await prisma.benutzer.findUnique({
|
const user = await prisma.benutzer.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid
|
id: input.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [user];
|
return [user];
|
||||||
} else {
|
} else {
|
||||||
const users = await prisma.benutzer.findMany({
|
const users = await prisma.benutzer.findMany({
|
||||||
@@ -82,7 +87,7 @@ export const PUT = defineApiRoute({
|
|||||||
name: z.string()
|
name: z.string()
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix
|
id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
async fetch(input) {
|
async fetch(input) {
|
||||||
const existingUser = await prisma.benutzer.findUnique({
|
const existingUser = await prisma.benutzer.findUnique({
|
||||||
@@ -98,17 +103,20 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.User);
|
||||||
|
|
||||||
const user = await prisma.benutzer.create({
|
const user = await prisma.benutzer.create({
|
||||||
data: {
|
data: {
|
||||||
email: input.email,
|
email: input.email,
|
||||||
passwort: hashPassword(input.passwort),
|
passwort: hashPassword(input.passwort),
|
||||||
vorname: input.vorname,
|
vorname: input.vorname,
|
||||||
name: input.name
|
name: input.name,
|
||||||
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await sendRegisterMail(user)
|
await sendRegisterMail(user)
|
||||||
|
|
||||||
return { uid: user.uid }
|
return { id }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { OptionalNullable, UUidWithPrefix, VerbrauchsausweisGewerbeClient, ZodOverlap } from "#components/Ausweis/types.js";
|
import { OptionalNullable, UUidWithPrefix, VerbrauchsausweisGewerbeClient, ZodOverlap } from "#components/Ausweis/types.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { exclude } from "#lib/exclude.js";
|
import { exclude } from "#lib/exclude.js";
|
||||||
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { Enums, prisma } from "#lib/server/prisma.js";
|
import { Enums, prisma } from "#lib/server/prisma.js";
|
||||||
@@ -8,7 +10,6 @@ import { z } from "zod";
|
|||||||
|
|
||||||
export const PATCH = defineApiRoute({
|
export const PATCH = defineApiRoute({
|
||||||
input: VerbrauchsausweisGewerbeSchema.omit({
|
input: VerbrauchsausweisGewerbeSchema.omit({
|
||||||
uid: true,
|
|
||||||
id: true,
|
id: true,
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
aufnahme_id: true,
|
aufnahme_id: true,
|
||||||
@@ -25,7 +26,7 @@ export const PATCH = defineApiRoute({
|
|||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const objekt = await prisma.verbrauchsausweisGewerbe.findUnique({
|
const objekt = await prisma.verbrauchsausweisGewerbe.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid,
|
id: ctx.params.id,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
}
|
}
|
||||||
@@ -41,7 +42,7 @@ export const PATCH = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.verbrauchsausweisGewerbe.update({
|
await prisma.verbrauchsausweisGewerbe.update({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid
|
id: ctx.params.id
|
||||||
},
|
},
|
||||||
data: input
|
data: input
|
||||||
})
|
})
|
||||||
@@ -55,12 +56,12 @@ export const DELETE = defineApiRoute({
|
|||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
if (!UUidWithPrefix.safeParse(uid).success) {
|
if (!UUidWithPrefix.safeParse(id).success) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "UID konnte nicht verifiziert werden."
|
message: "id konnte nicht verifiziert werden."
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ export const DELETE = defineApiRoute({
|
|||||||
// Dieser MUSS mit dem Nutzer verknüpft sein.
|
// Dieser MUSS mit dem Nutzer verknüpft sein.
|
||||||
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ export const DELETE = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.verbrauchsausweisGewerbe.update({
|
await prisma.verbrauchsausweisGewerbe.update({
|
||||||
where: {
|
where: {
|
||||||
uid
|
id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
storniert: true
|
storniert: true
|
||||||
@@ -119,6 +120,7 @@ export const DELETE = defineApiRoute({
|
|||||||
// Dann können wir das in der Historie anzeigen
|
// Dann können wir das in der Historie anzeigen
|
||||||
await prisma.event.create({
|
await prisma.event.create({
|
||||||
data: {
|
data: {
|
||||||
|
id: generatePrefixedId(6, VALID_UUID_PREFIXES.Event),
|
||||||
title: "Ausweis storniert",
|
title: "Ausweis storniert",
|
||||||
description: ((user.rolle === "ADMIN") && (ausweis.benutzer_id !== user.id)) ? "Ausweis wurde von einem Administrator storniert." : "Ausweis wurde vom Besitzer storniert.",
|
description: ((user.rolle === "ADMIN") && (ausweis.benutzer_id !== user.id)) ? "Ausweis wurde von einem Administrator storniert." : "Ausweis wurde vom Besitzer storniert.",
|
||||||
benutzer: {
|
benutzer: {
|
||||||
@@ -154,42 +156,36 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
output: ZodOverlap<OptionalNullable<VerbrauchsausweisGewerbeClient>>(VerbrauchsausweisGewerbeSchema.merge(z.object({
|
output: ZodOverlap<OptionalNullable<VerbrauchsausweisGewerbeClient>>(VerbrauchsausweisGewerbeSchema.merge(z.object({
|
||||||
uid_aufnahme: UUidWithPrefix,
|
objekt_id: UUidWithPrefix,
|
||||||
uid_objekt: UUidWithPrefix,
|
}))),
|
||||||
uid_benutzer: UUidWithPrefix.optional()
|
|
||||||
})).omit({
|
|
||||||
id: true,
|
|
||||||
aufnahme_id: true,
|
|
||||||
benutzer_id: true
|
|
||||||
})),
|
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const { uid } = context.params;
|
const { id } = context.params;
|
||||||
|
|
||||||
if (!uid) {
|
if (!id) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "Missing uid in request params"
|
message: "Missing id in request params"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
||||||
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
} : { uid },
|
} : { id },
|
||||||
include: {
|
include: {
|
||||||
benutzer: {
|
benutzer: {
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
objekt: {
|
objekt: {
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,10 +202,8 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid_aufnahme: ausweis.aufnahme.uid,
|
objekt_id: ausweis.aufnahme.objekt.id,
|
||||||
uid_objekt: ausweis.aufnahme.objekt.uid,
|
...exclude(ausweis, ["aufnahme"])
|
||||||
uid_benutzer: ausweis.benutzer?.uid,
|
|
||||||
...exclude(ausweis, ["id", "aufnahme_id", "benutzer_id", "aufnahme"])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
@@ -16,7 +18,6 @@ export const PUT = defineApiRoute({
|
|||||||
ausweis: VerbrauchsausweisGewerbeSchema.omit({
|
ausweis: VerbrauchsausweisGewerbeSchema.omit({
|
||||||
id: true,
|
id: true,
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
uid: true,
|
|
||||||
aufnahme_id: true,
|
aufnahme_id: true,
|
||||||
rechnung_id: true,
|
rechnung_id: true,
|
||||||
updated_at: true,
|
updated_at: true,
|
||||||
@@ -24,19 +25,19 @@ export const PUT = defineApiRoute({
|
|||||||
}).merge(z.object({
|
}).merge(z.object({
|
||||||
startdatum: z.coerce.date()
|
startdatum: z.coerce.date()
|
||||||
})),
|
})),
|
||||||
uid_aufnahme: UUidWithPrefix
|
aufnahme_id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix,
|
id: UUidWithPrefix,
|
||||||
objekt_uid: UUidWithPrefix,
|
objekt_id: UUidWithPrefix,
|
||||||
aufnahme_uid: UUidWithPrefix,
|
aufnahme_id: UUidWithPrefix,
|
||||||
}),
|
}),
|
||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid_aufnahme
|
id: input.aufnahme_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -47,8 +48,11 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.VerbrauchsausweisGewerbe)
|
||||||
|
|
||||||
const createdAusweis = await prisma.verbrauchsausweisGewerbe.create({
|
const createdAusweis = await prisma.verbrauchsausweisGewerbe.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
...input.ausweis,
|
...input.ausweis,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
connect: {
|
connect: {
|
||||||
@@ -57,18 +61,18 @@ export const PUT = defineApiRoute({
|
|||||||
},
|
},
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: aufnahme.uid,
|
id: aufnahme.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
objekt: {
|
objekt: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -77,9 +81,9 @@ export const PUT = defineApiRoute({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: createdAusweis.uid,
|
id: id,
|
||||||
objekt_uid: createdAusweis.aufnahme.objekt.uid,
|
objekt_id: createdAusweis.aufnahme.objekt.id,
|
||||||
aufnahme_uid: createdAusweis.aufnahme.uid,
|
aufnahme_id: createdAusweis.aufnahme.id,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -103,11 +107,11 @@ export const GET = defineApiRoute({
|
|||||||
},
|
},
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const { uid } = context.params;
|
const { id } = context.params;
|
||||||
|
|
||||||
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
const ausweis = await prisma.verbrauchsausweisGewerbe.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
benutzer: true,
|
benutzer: true,
|
||||||
@@ -118,7 +122,7 @@ export const GET = defineApiRoute({
|
|||||||
include: {
|
include: {
|
||||||
benutzer: {
|
benutzer: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { OptionalNullable, UUidWithPrefix, VerbrauchsausweisWohnenClient, ZodOverlap } from "#components/Ausweis/types.js";
|
import { OptionalNullable, UUidWithPrefix, VerbrauchsausweisWohnenClient, ZodOverlap } from "#components/Ausweis/types.js";
|
||||||
|
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { exclude } from "#lib/exclude.js";
|
import { exclude } from "#lib/exclude.js";
|
||||||
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { Enums, prisma } from "#lib/server/prisma.js";
|
import { Enums, prisma } from "#lib/server/prisma.js";
|
||||||
@@ -8,7 +10,6 @@ import { z } from "zod";
|
|||||||
|
|
||||||
export const PATCH = defineApiRoute({
|
export const PATCH = defineApiRoute({
|
||||||
input: VerbrauchsausweisWohnenSchema.omit({
|
input: VerbrauchsausweisWohnenSchema.omit({
|
||||||
uid: true,
|
|
||||||
id: true,
|
id: true,
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
aufnahme_id: true,
|
aufnahme_id: true,
|
||||||
@@ -26,7 +27,7 @@ export const PATCH = defineApiRoute({
|
|||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const objekt = await prisma.verbrauchsausweisWohnen.findUnique({
|
const objekt = await prisma.verbrauchsausweisWohnen.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid,
|
id: ctx.params.id,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
id: user.id
|
id: user.id
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,7 @@ export const PATCH = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.verbrauchsausweisWohnen.update({
|
await prisma.verbrauchsausweisWohnen.update({
|
||||||
where: {
|
where: {
|
||||||
uid: ctx.params.uid
|
id: ctx.params.id
|
||||||
},
|
},
|
||||||
data: input
|
data: input
|
||||||
})
|
})
|
||||||
@@ -56,9 +57,9 @@ export const DELETE = defineApiRoute({
|
|||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const { uid } = ctx.params;
|
const { id } = ctx.params;
|
||||||
|
|
||||||
if (!UUidWithPrefix.safeParse(uid).success) {
|
if (!UUidWithPrefix.safeParse(id).success) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "UID konnte nicht verifiziert werden."
|
message: "UID konnte nicht verifiziert werden."
|
||||||
@@ -69,7 +70,7 @@ export const DELETE = defineApiRoute({
|
|||||||
// Dieser MUSS mit dem Nutzer verknüpft sein.
|
// Dieser MUSS mit dem Nutzer verknüpft sein.
|
||||||
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ export const DELETE = defineApiRoute({
|
|||||||
|
|
||||||
await prisma.verbrauchsausweisWohnen.update({
|
await prisma.verbrauchsausweisWohnen.update({
|
||||||
where: {
|
where: {
|
||||||
uid
|
id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
storniert: true
|
storniert: true
|
||||||
@@ -120,6 +121,7 @@ export const DELETE = defineApiRoute({
|
|||||||
// Dann können wir das in der Historie anzeigen
|
// Dann können wir das in der Historie anzeigen
|
||||||
await prisma.event.create({
|
await prisma.event.create({
|
||||||
data: {
|
data: {
|
||||||
|
id: generatePrefixedId(6, VALID_UUID_PREFIXES.Event),
|
||||||
title: "Ausweis storniert",
|
title: "Ausweis storniert",
|
||||||
description: ((user.rolle === "ADMIN") && (ausweis.benutzer_id !== user.id)) ? "Ausweis wurde von einem Administrator storniert." : "Ausweis wurde vom Besitzer storniert.",
|
description: ((user.rolle === "ADMIN") && (ausweis.benutzer_id !== user.id)) ? "Ausweis wurde von einem Administrator storniert." : "Ausweis wurde vom Besitzer storniert.",
|
||||||
benutzer: {
|
benutzer: {
|
||||||
@@ -155,42 +157,36 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
output: ZodOverlap<OptionalNullable<VerbrauchsausweisWohnenClient>>(VerbrauchsausweisWohnenSchema.merge(z.object({
|
output: ZodOverlap<OptionalNullable<VerbrauchsausweisWohnenClient>>(VerbrauchsausweisWohnenSchema.merge(z.object({
|
||||||
uid_aufnahme: UUidWithPrefix,
|
objekt_id: UUidWithPrefix
|
||||||
uid_objekt: UUidWithPrefix,
|
}))),
|
||||||
uid_benutzer: UUidWithPrefix.optional()
|
|
||||||
})).omit({
|
|
||||||
id: true,
|
|
||||||
aufnahme_id: true,
|
|
||||||
benutzer_id: true
|
|
||||||
})),
|
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const { uid } = context.params;
|
const { id } = context.params;
|
||||||
|
|
||||||
if (!uid) {
|
if (!id) {
|
||||||
throw new APIError({
|
throw new APIError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "Missing uid in request params"
|
message: "Missing id in request params"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
||||||
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
uid,
|
id,
|
||||||
benutzer_id: user.id
|
benutzer_id: user.id
|
||||||
} : { uid },
|
} : { id },
|
||||||
include: {
|
include: {
|
||||||
benutzer: {
|
benutzer: {
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
objekt: {
|
objekt: {
|
||||||
select: {
|
select: {
|
||||||
uid: true
|
id: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,10 +203,8 @@ export const GET = defineApiRoute({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid_aufnahme: ausweis.aufnahme.uid,
|
objekt_id: ausweis.aufnahme.objekt.id,
|
||||||
uid_objekt: ausweis.aufnahme.objekt.uid,
|
...exclude(ausweis, ["aufnahme"])
|
||||||
uid_benutzer: ausweis.benutzer?.uid,
|
|
||||||
...exclude(ausweis, ["id", "aufnahme_id", "benutzer_id", "aufnahme"])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
import { generatePrefixedId } from "#lib/db.js";
|
||||||
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
@@ -22,25 +23,24 @@ export const PUT = defineApiRoute({
|
|||||||
})).omit({
|
})).omit({
|
||||||
id: true,
|
id: true,
|
||||||
benutzer_id: true,
|
benutzer_id: true,
|
||||||
uid: true,
|
|
||||||
aufnahme_id: true,
|
aufnahme_id: true,
|
||||||
rechnung_id: true,
|
rechnung_id: true,
|
||||||
created_at: true,
|
created_at: true,
|
||||||
updated_at: true
|
updated_at: true
|
||||||
}),
|
}),
|
||||||
uid_aufnahme: UUidWithPrefix
|
aufnahme_id: UUidWithPrefix
|
||||||
}),
|
}),
|
||||||
output: z.object({
|
output: z.object({
|
||||||
uid: UUidWithPrefix,
|
id: UUidWithPrefix,
|
||||||
objekt_uid: UUidWithPrefix,
|
objekt_id: UUidWithPrefix,
|
||||||
aufnahme_uid: UUidWithPrefix,
|
aufnahme_id: UUidWithPrefix,
|
||||||
}),
|
}),
|
||||||
headers: authorizationHeaders,
|
headers: authorizationHeaders,
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, ctx, user) {
|
async fetch(input, ctx, user) {
|
||||||
const aufnahme = await prisma.aufnahme.findUnique({
|
const aufnahme = await prisma.aufnahme.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid: input.uid_aufnahme
|
id: input.aufnahme_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -51,8 +51,11 @@ export const PUT = defineApiRoute({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const id = generatePrefixedId(6, "VW");
|
||||||
|
|
||||||
const createdAusweis = await prisma.verbrauchsausweisWohnen.create({
|
const createdAusweis = await prisma.verbrauchsausweisWohnen.create({
|
||||||
data: {
|
data: {
|
||||||
|
id,
|
||||||
...input.ausweis,
|
...input.ausweis,
|
||||||
benutzer: {
|
benutzer: {
|
||||||
connect: {
|
connect: {
|
||||||
@@ -61,18 +64,18 @@ export const PUT = defineApiRoute({
|
|||||||
},
|
},
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
connect: {
|
connect: {
|
||||||
uid: aufnahme.uid,
|
id: aufnahme.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
aufnahme: {
|
aufnahme: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
objekt: {
|
objekt: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -81,9 +84,9 @@ export const PUT = defineApiRoute({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uid: createdAusweis.uid,
|
id: createdAusweis.id,
|
||||||
objekt_uid: createdAusweis.aufnahme.objekt.uid,
|
objekt_id: createdAusweis.aufnahme.objekt.id,
|
||||||
aufnahme_uid: createdAusweis.aufnahme.uid,
|
aufnahme_id: createdAusweis.aufnahme.id,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -107,11 +110,11 @@ export const GET = defineApiRoute({
|
|||||||
},
|
},
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
const { uid } = context.params;
|
const { id } = context.params;
|
||||||
|
|
||||||
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
benutzer: true,
|
benutzer: true,
|
||||||
@@ -122,7 +125,7 @@ export const GET = defineApiRoute({
|
|||||||
include: {
|
include: {
|
||||||
benutzer: {
|
benutzer: {
|
||||||
select: {
|
select: {
|
||||||
uid: true,
|
id: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import { APIRoute } from "astro";
|
|||||||
import { getS3File } from "#lib/s3.js";
|
import { getS3File } from "#lib/s3.js";
|
||||||
|
|
||||||
export const GET: APIRoute = async (Astro) => {
|
export const GET: APIRoute = async (Astro) => {
|
||||||
const { uid } = Astro.params;
|
const { id } = Astro.params;
|
||||||
|
|
||||||
const image = await prisma.bild.findUnique({
|
const image = await prisma.bild.findUnique({
|
||||||
where: {
|
where: {
|
||||||
uid,
|
id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export const GET: APIRoute = async (Astro) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const file = await getS3File("ibc-images", `${image.uid}.jpg`);
|
const file = await getS3File("ibc-images", `${image.id}.jpg`);
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
const file = await getS3File("ibc-images", `${image.name}.jpg`)
|
const file = await getS3File("ibc-images", `${image.name}.jpg`)
|
||||||
113
src/pages/dashboard/aufnahme/index.astro
Normal file
113
src/pages/dashboard/aufnahme/index.astro
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
---
|
||||||
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||||
|
import { prisma, Enums } from "#lib/server/prisma";
|
||||||
|
import { createCaller } from "src/astro-typesafe-api-caller";
|
||||||
|
|
||||||
|
const caller = createCaller(Astro)
|
||||||
|
|
||||||
|
const id = Astro.url.searchParams.get("id");
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return Astro.redirect("/dashboard/objekte")
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await caller.user.self.GET.fetch(undefined, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return Astro.redirect("/auth/login")
|
||||||
|
}
|
||||||
|
|
||||||
|
const objekte = await prisma.objekt.findFirst({
|
||||||
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
|
benutzer: {
|
||||||
|
id: user.id
|
||||||
|
},
|
||||||
|
} : {
|
||||||
|
...(id ? {OR: [
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_gewerbe: {
|
||||||
|
some: {
|
||||||
|
alte_ausweis_id: parseInt(id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
alte_ausweis_id: parseInt(id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
bedarfsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
alte_ausweis_id: parseInt(id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_gewerbe: {
|
||||||
|
some: {
|
||||||
|
id: `VG${id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
id: `VW${id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
bedarfsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
id: `BW${id}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},]} : {})
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
erstellungsdatum: "desc"
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
aufnahmen: {
|
||||||
|
include: {
|
||||||
|
bilder: true,
|
||||||
|
unterlagen: true,
|
||||||
|
bedarfsausweise_wohnen: true,
|
||||||
|
verbrauchsausweise_gewerbe: true,
|
||||||
|
verbrauchsausweise_wohnen: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
---
|
||||||
@@ -40,7 +40,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
...(id ? {OR: [
|
...(id ? {OR: [
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
verbrauchsausweise_gewerbe: {
|
verbrauchsausweise_gewerbe: {
|
||||||
some: {
|
some: {
|
||||||
alte_ausweis_id: parseInt(id)
|
alte_ausweis_id: parseInt(id)
|
||||||
@@ -51,7 +51,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
verbrauchsausweise_wohnen: {
|
verbrauchsausweise_wohnen: {
|
||||||
some: {
|
some: {
|
||||||
alte_ausweis_id: parseInt(id)
|
alte_ausweis_id: parseInt(id)
|
||||||
@@ -62,7 +62,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
bedarfsausweise_wohnen: {
|
bedarfsausweise_wohnen: {
|
||||||
some: {
|
some: {
|
||||||
alte_ausweis_id: parseInt(id)
|
alte_ausweis_id: parseInt(id)
|
||||||
@@ -73,7 +73,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
verbrauchsausweise_gewerbe: {
|
verbrauchsausweise_gewerbe: {
|
||||||
some: {
|
some: {
|
||||||
uid: {
|
uid: {
|
||||||
@@ -86,7 +86,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
verbrauchsausweise_wohnen: {
|
verbrauchsausweise_wohnen: {
|
||||||
some: {
|
some: {
|
||||||
uid: {
|
uid: {
|
||||||
@@ -99,7 +99,7 @@ const objekte = await prisma.objekt.findMany({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
aufnahmen: {
|
aufnahmen: {
|
||||||
some: {
|
every: {
|
||||||
bedarfsausweise_wohnen: {
|
bedarfsausweise_wohnen: {
|
||||||
some: {
|
some: {
|
||||||
uid: {
|
uid: {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
|||||||
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
||||||
import { Enums } from "#lib/server/prisma";
|
import { Enums } from "#lib/server/prisma";
|
||||||
|
|
||||||
const uid = Astro.url.searchParams.get("uid");
|
const id = Astro.url.searchParams.get("id");
|
||||||
const uid_aufnahme = Astro.url.searchParams.get("aufnahme")
|
const aufnahme_id = Astro.url.searchParams.get("aufnahme")
|
||||||
let ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
let ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
||||||
|
|
||||||
let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient;
|
let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient;
|
||||||
@@ -20,7 +20,7 @@ const valid = validateAccessTokenServer(Astro);
|
|||||||
|
|
||||||
const caller = createCaller(Astro);
|
const caller = createCaller(Astro);
|
||||||
|
|
||||||
if (uid) {
|
if (id) {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return Astro.redirect(
|
return Astro.redirect(
|
||||||
`/auth/login?redirect=${Astro.url.toString()}`
|
`/auth/login?redirect=${Astro.url.toString()}`
|
||||||
@@ -28,41 +28,41 @@ if (uid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ausweis = await caller["verbrauchsausweis-wohnen"]._uid.GET.fetch(null, {
|
ausweis = await caller["verbrauchsausweis-wohnen"]._id.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid
|
id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ausweistyp = ausweis.ausweistyp
|
ausweistyp = ausweis.ausweistyp
|
||||||
|
|
||||||
aufnahme = await caller.aufnahme._uid.GET.fetch(null, {
|
aufnahme = await caller.aufnahme._id.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid: ausweis.uid_aufnahme
|
id: ausweis.aufnahme_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
objekt = await caller.objekt._uid.GET.fetch(null, {
|
objekt = await caller.objekt._id.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid: ausweis.uid_objekt
|
id: ausweis.objekt_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
bilder = await caller.aufnahme._uid.bilder.GET.fetch(null, {
|
bilder = await caller.aufnahme._id.bilder.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid: ausweis.uid_aufnahme
|
id: ausweis.aufnahme_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -78,35 +78,35 @@ if (uid) {
|
|||||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (uid_aufnahme) {
|
} else if (aufnahme_id) {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return Astro.redirect(
|
return Astro.redirect(
|
||||||
`/auth/login?redirect=${Astro.url.toString()}`
|
`/auth/login?redirect=${Astro.url.toString()}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let { uid_objekt, ...result} = await caller.aufnahme._uid.GET.fetch(null, {
|
let { objekt_id, ...result} = await caller.aufnahme._id.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid: uid_aufnahme
|
id: aufnahme_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
aufnahme = result;
|
aufnahme = result;
|
||||||
|
|
||||||
objekt = await caller.objekt._uid.GET.fetch(null, {
|
objekt = await caller.objekt._id.GET.fetch(null, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
uid: uid_objekt
|
id: objekt_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<AusweisLayout title="Verbrauchsausweis erstellen">
|
<AusweisLayout title="Verbrauchsausweis erstellen">
|
||||||
<VerbrauchsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {uid} {ausweistyp} />
|
<VerbrauchsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {id} {ausweistyp} />
|
||||||
</AusweisLayout>
|
</AusweisLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user