diff --git a/Makefile b/Makefile
index 8555a0c4..0e296ebd 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ stop-database:
- docker stop $(DB_CONTAINER_NAME)
- docker rm $(DB_CONTAINER_NAME)
-wait-fordatabase:
+wait-for-database:
@while ! docker exec $(DB_CONTAINER_NAME) pg_isready -U $(DB_USER) -h localhost -p $(DB_PORT) > /dev/null 2>&1; do \
sleep 1; \
done
@@ -68,4 +68,4 @@ prod: install-dependencies prisma-studio backup-database-cronjob
backup-database-cronjob:
- pm2 delete daily-db-backup
- pm2 start backup-database.bash --name "daily-db-backup" --cron "0 0 * * *"
\ No newline at end of file
+ pm2 start bash --name "daily-db-backup" --cron "0 0 * * *" -- backup-database.bash
\ No newline at end of file
diff --git a/bun.lock b/bun.lock
index 36f6b9a9..4025e1f8 100644
--- a/bun.lock
+++ b/bun.lock
@@ -18,7 +18,7 @@
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"astro": "^4.16.17",
- "astro-typesafe-api": "^0.2.2",
+ "astro-typesafe-api": "^0.2.4",
"body-scroll-lock": "^4.0.0-beta.0",
"buffer": "^6.0.3",
"bun": "^1.2.5",
@@ -44,6 +44,7 @@
"siema": "^1.5.1",
"soap": "^1.1.8",
"sqids": "^0.3.0",
+ "ssh2-sftp-client": "^12.0.0",
"svelte": "^3.59.2",
"svelte-dialogs": "^1.2.2",
"svelte-preprocess": "^5.1.4",
@@ -67,6 +68,7 @@
"@types/nodemailer": "^6.4.17",
"@types/papaparse": "^5.3.15",
"@types/siema": "^1.4.11",
+ "@types/ssh2-sftp-client": "^9.0.4",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
@@ -82,11 +84,11 @@
"postcss-import": "^16.1.0",
"postcss-nesting": "^13.0.1",
"prettier": "^2.8.8",
- "prisma": "^6.4.1",
+ "prisma": "6.4.1",
"prisma-dbml-generator": "^0.12.0",
"prisma-generator-fake-data": "^0.14.3",
"tsx": "^4.19.3",
- "typescript": "^5",
+ "typescript": "^5.8.3",
"zod-prisma": "^0.5.4",
},
},
@@ -807,6 +809,10 @@
"@types/sizzle": ["@types/sizzle@2.3.9", "", {}, "sha512-xzLEyKB50yqCUPUJkIsrVvoWNfFUbIZI+RspLWt8u+tIW/BetMBZtgV2LY/2o+tYH8dRvQ+eoPf3NdhQCcLE2w=="],
+ "@types/ssh2": ["@types/ssh2@1.15.5", "", { "dependencies": { "@types/node": "^18.11.18" } }, "sha512-N1ASjp/nXH3ovBHddRJpli4ozpk6UdDYIX4RJWFa9L1YKnzdhTlVmiGHm4DZnj/jLbqZpes4aeR30EFGQtvhQQ=="],
+
+ "@types/ssh2-sftp-client": ["@types/ssh2-sftp-client@9.0.4", "", { "dependencies": { "@types/ssh2": "^1.0.0" } }, "sha512-gnIn56MTB9W3A3hPL/1sHI23t8YwcE3eVYa1O2XjT9vaqimFdtNHxyQiy5Y78+ociQTKazMSD8YyMEO4QjNMrg=="],
+
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
"@types/uuid": ["@types/uuid@9.0.8", "", {}, "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="],
@@ -909,7 +915,7 @@
"astro": ["astro@4.16.18", "", { "dependencies": { "@astrojs/compiler": "^2.10.3", "@astrojs/internal-helpers": "0.4.1", "@astrojs/markdown-remark": "5.3.0", "@astrojs/telemetry": "3.1.0", "@babel/core": "^7.26.0", "@babel/plugin-transform-react-jsx": "^7.25.9", "@babel/types": "^7.26.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.3", "@types/babel__core": "^7.20.5", "@types/cookie": "^0.6.0", "acorn": "^8.14.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.1.0", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^0.7.2", "cssesc": "^3.0.0", "debug": "^4.3.7", "deterministic-object-hash": "^2.0.2", "devalue": "^5.1.1", "diff": "^5.2.0", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.5.4", "esbuild": "^0.21.5", "estree-walker": "^3.0.3", "fast-glob": "^3.3.2", "flattie": "^1.1.1", "github-slugger": "^2.0.0", "gray-matter": "^4.0.3", "html-escaper": "^3.0.3", "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", "magic-string": "^0.30.14", "magicast": "^0.3.5", "micromatch": "^4.0.8", "mrmime": "^2.0.0", "neotraverse": "^0.6.18", "ora": "^8.1.1", "p-limit": "^6.1.0", "p-queue": "^8.0.1", "preferred-pm": "^4.0.0", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.6.3", "shiki": "^1.23.1", "tinyexec": "^0.3.1", "tsconfck": "^3.1.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.3", "vite": "^5.4.11", "vitefu": "^1.0.4", "which-pm": "^3.0.0", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "zod": "^3.23.8", "zod-to-json-schema": "^3.23.5", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.33.3" }, "bin": { "astro": "astro.js" } }, "sha512-G7zfwJt9BDHEZwlaLNvjbInIw2hPryyD654314KV/XT34pJU6SfN1S+mWa8RAkALcZNJnJXCJmT3JXLQStD3Lw=="],
- "astro-typesafe-api": ["astro-typesafe-api@0.2.2", "", { "dependencies": { "es-codec": "^0.5.0", "globby": "^14.0.2" }, "peerDependencies": { "astro": "^4.16.17", "typescript": "^5.0.0", "zod": "^3.24.1" }, "bin": { "astro-typesafe-api": "src/cli.ts" } }, "sha512-SEHV2iPyIrdpYdYb0mIN1WmcvC61bvsCQqb/X+R4EOcFjuozJ9fJhSiFGxJMvNoxJ9S3P3GKLyDnxXvFlKq0mw=="],
+ "astro-typesafe-api": ["astro-typesafe-api@0.2.4", "", { "dependencies": { "es-codec": "^0.5.0", "globby": "^14.0.2" }, "peerDependencies": { "astro": "^4.16.17", "typescript": "^5.0.0", "zod": "^3.24.1" }, "bin": { "astro-typesafe-api": "src/cli.ts" } }, "sha512-KiAw7+QJyuzz606GSkeaTdav8vttDUEYVaFAdVRlDuSvUdhcYsJB14zHkMe6ZSMfRNBQRxaMZBgPgEtWb1mf1w=="],
"async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="],
@@ -975,6 +981,10 @@
"buffer-equal-constant-time": ["buffer-equal-constant-time@1.0.1", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="],
+ "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="],
+
+ "buildcheck": ["buildcheck@0.0.6", "", {}, "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A=="],
+
"bun": ["bun@1.2.5", "", { "optionalDependencies": { "@oven/bun-darwin-aarch64": "1.2.5", "@oven/bun-darwin-x64": "1.2.5", "@oven/bun-darwin-x64-baseline": "1.2.5", "@oven/bun-linux-aarch64": "1.2.5", "@oven/bun-linux-aarch64-musl": "1.2.5", "@oven/bun-linux-x64": "1.2.5", "@oven/bun-linux-x64-baseline": "1.2.5", "@oven/bun-linux-x64-musl": "1.2.5", "@oven/bun-linux-x64-musl-baseline": "1.2.5", "@oven/bun-windows-x64": "1.2.5", "@oven/bun-windows-x64-baseline": "1.2.5" }, "os": [ "linux", "win32", "darwin", ], "cpu": [ "x64", "arm64", ], "bin": { "bun": "bin/bun.exe", "bunx": "bin/bun.exe" } }, "sha512-fbQLt+DPiGUrPKdmsHRRT7cQAlfjdxPVFvLZrsUPmKiTdv+pU50ypdx9yRJluknSbyaZchFVV7Lx2KXikXKX2Q=="],
"bun-types": ["bun-types@1.2.2", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-RCbMH5elr9gjgDGDhkTTugA21XtJAy/9jkKe/G3WR2q17VPGhcquf9Sir6uay9iW+7P/BV0CAHA1XlHXMAVKHg=="],
@@ -1083,6 +1093,8 @@
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
+ "concat-stream": ["concat-stream@2.0.0", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.0.2", "typedarray": "^0.0.6" } }, "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A=="],
+
"consola": ["consola@3.4.0", "", {}, "sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA=="],
"console-control-strings": ["console-control-strings@1.1.0", "", {}, "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="],
@@ -1107,6 +1119,8 @@
"core-util-is": ["core-util-is@1.0.2", "", {}, "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="],
+ "cpu-features": ["cpu-features@0.0.10", "", { "dependencies": { "buildcheck": "~0.0.6", "nan": "^2.19.0" } }, "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA=="],
+
"crc-32": ["crc-32@1.2.2", "", { "bin": { "crc32": "bin/crc32.njs" } }, "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="],
"crc32-stream": ["crc32-stream@4.0.3", "", { "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" } }, "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw=="],
@@ -2395,6 +2409,10 @@
"sqids": ["sqids@0.3.0", "", {}, "sha512-lOQK1ucVg+W6n3FhRwwSeUijxe93b51Bfz5PMRMihVf1iVkl82ePQG7V5vwrhzB11v0NtsR25PSZRGiSomJaJw=="],
+ "ssh2": ["ssh2@1.16.0", "", { "dependencies": { "asn1": "^0.2.6", "bcrypt-pbkdf": "^1.0.2" }, "optionalDependencies": { "cpu-features": "~0.0.10", "nan": "^2.20.0" } }, "sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg=="],
+
+ "ssh2-sftp-client": ["ssh2-sftp-client@12.0.0", "", { "dependencies": { "concat-stream": "^2.0.0", "ssh2": "^1.16.0" } }, "sha512-k+ocDsx6N2eDwQlIRwJFa0I1bkQpFPhIc+cv1iplaQaIPXFt9YM1ZnXCJOW4OILS5dzE+12OlhYIF5g0AzgVfg=="],
+
"sshpk": ["sshpk@1.18.0", "", { "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", "dashdash": "^1.12.0", "ecc-jsbn": "~0.1.1", "getpass": "^0.1.1", "jsbn": "~0.1.0", "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, "bin": { "sshpk-conv": "bin/sshpk-conv", "sshpk-sign": "bin/sshpk-sign", "sshpk-verify": "bin/sshpk-verify" } }, "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ=="],
"statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
@@ -2539,6 +2557,8 @@
"type-is": ["type-is@1.6.18", "", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
+ "typedarray": ["typedarray@0.0.6", "", {}, "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="],
+
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
"ufo": ["ufo@1.5.4", "", {}, "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ=="],
@@ -2741,6 +2761,8 @@
"@sveltejs/vite-plugin-svelte/vitefu": ["vitefu@0.2.5", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" }, "optionalPeers": ["vite"] }, "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q=="],
+ "@types/ssh2/@types/node": ["@types/node@18.19.86", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-fifKayi175wLyKyc5qUfyENhQ1dCNI1UNjp653d8kuYcPQN5JhX3dGuP/XmvPTg/xRBn1VTLpbmi+H/Mr7tLfQ=="],
+
"@typescript-eslint/typescript-estree/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="],
"@typescript-eslint/utils/eslint-scope": ["eslint-scope@5.1.1", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" } }, "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw=="],
@@ -3001,6 +3023,8 @@
"@prisma/internals/globby/slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="],
+ "@types/ssh2/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
+
"@typescript-eslint/typescript-estree/globby/slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="],
"@typescript-eslint/utils/eslint-scope/estraverse": ["estraverse@4.3.0", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],
diff --git a/package.json b/package.json
index f2cc686e..2cb61050 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"astro": "^4.16.17",
- "astro-typesafe-api": "^0.2.2",
+ "astro-typesafe-api": "^0.2.4",
"body-scroll-lock": "^4.0.0-beta.0",
"buffer": "^6.0.3",
"bun": "^1.2.5",
@@ -58,6 +58,7 @@
"siema": "^1.5.1",
"soap": "^1.1.8",
"sqids": "^0.3.0",
+ "ssh2-sftp-client": "^12.0.0",
"svelte": "^3.59.2",
"svelte-dialogs": "^1.2.2",
"svelte-preprocess": "^5.1.4",
@@ -81,6 +82,7 @@
"@types/nodemailer": "^6.4.17",
"@types/papaparse": "^5.3.15",
"@types/siema": "^1.4.11",
+ "@types/ssh2-sftp-client": "^9.0.4",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts
index bad30554..83fb19ee 100644
--- a/src/astro-typesafe-api-caller.ts
+++ b/src/astro-typesafe-api-caller.ts
@@ -9,35 +9,34 @@ export const createCaller = createCallerFactory({
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
"admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"),
"admin/nicht-ausstellen": await import("../src/pages/api/admin/nicht-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/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
+ "bedarfsausweis-gewerbe/[id]": await import("../src/pages/api/bedarfsausweis-gewerbe/[id].ts"),
+ "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
- "ausweise": await import("../src/pages/api/ausweise/index.ts"),
+ "bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"),
+ "bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
"auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
"auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
- "bedarfsausweis-gewerbe/[id]": await import("../src/pages/api/bedarfsausweis-gewerbe/[id].ts"),
- "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
- "bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"),
- "bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
- "bilder/[id]": await import("../src/pages/api/bilder/[id].ts"),
- "geg-nachweis-gewerbe/[id]": await import("../src/pages/api/geg-nachweis-gewerbe/[id].ts"),
- "geg-nachweis-gewerbe": await import("../src/pages/api/geg-nachweis-gewerbe/index.ts"),
+ "ausweise": await import("../src/pages/api/ausweise/index.ts"),
"geg-nachweis-wohnen/[id]": await import("../src/pages/api/geg-nachweis-wohnen/[id].ts"),
"geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
+ "geg-nachweis-gewerbe/[id]": await import("../src/pages/api/geg-nachweis-gewerbe/[id].ts"),
+ "geg-nachweis-gewerbe": await import("../src/pages/api/geg-nachweis-gewerbe/index.ts"),
+ "bilder/[id]": await import("../src/pages/api/bilder/[id].ts"),
+ "ticket": await import("../src/pages/api/ticket/index.ts"),
"objekt": await import("../src/pages/api/objekt/index.ts"),
"rechnung/[id]": await import("../src/pages/api/rechnung/[id].ts"),
"rechnung/anfordern": await import("../src/pages/api/rechnung/anfordern.ts"),
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
- "ticket": await import("../src/pages/api/ticket/index.ts"),
- "user": await import("../src/pages/api/user/index.ts"),
- "user/self": await import("../src/pages/api/user/self.ts"),
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"),
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
- "webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
+ "user": await import("../src/pages/api/user/index.ts"),
+ "user/self": await import("../src/pages/api/user/self.ts"),
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
+ "webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
"aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.ts"),
"aufnahme/[id]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
diff --git a/src/components/Ausweis/StromVerbrauch.svelte b/src/components/Ausweis/StromVerbrauch.svelte
index a94a0bdd..a211d017 100644
--- a/src/components/Ausweis/StromVerbrauch.svelte
+++ b/src/components/Ausweis/StromVerbrauch.svelte
@@ -63,8 +63,15 @@
fuelMap[fuel[0]].push(fuel[1]);
}
- let month = moment(ausweis.startdatum).month();
- let year = moment(ausweis.startdatum).year();
+ // Falls der Ausweis bereits einmal gespeichert wurde mit einem Startdatum sollten wir dieses benutzen.
+ let month: number, year: number;
+ if (ausweis.startdatum) {
+ month = moment(ausweis.startdatum).get("month")
+ year = moment(ausweis.startdatum).get("year")
+ } else {
+ month = availableDates[availableDates.length - 1].month;
+ year = availableDates[availableDates.length - 1].year;
+ }
$: {
if (typeof month === "number" && typeof year === "number") {
diff --git a/src/components/Ausweis/Verbrauch.svelte b/src/components/Ausweis/Verbrauch.svelte
index 2fdb312d..b2230421 100644
--- a/src/components/Ausweis/Verbrauch.svelte
+++ b/src/components/Ausweis/Verbrauch.svelte
@@ -40,15 +40,15 @@
"Dezember",
];
- const startDate = moment(aufnahme.erstellungsdatum || Date.now())
+ const earlistPossibleStartDate = moment(aufnahme.erstellungsdatum || Date.now())
.subtract(4, "years")
.subtract(6, "months");
- const endDate = moment(aufnahme.erstellungsdatum || Date.now()).subtract(
+ const lastPossibleEndDate = moment(aufnahme.erstellungsdatum || Date.now()).subtract(
3,
"years"
);
- for (let m = moment(startDate); m.isBefore(endDate); m.add(1, "month")) {
+ for (let m = moment(earlistPossibleStartDate); m.isBefore(lastPossibleEndDate); m.add(1, "month")) {
availableDates.push({
year: m.year(),
month: m.month(),
@@ -62,8 +62,15 @@
fuelMap[fuel[0]].push(fuel[1]);
}
- let month = availableDates[availableDates.length - 1].month;
- let year = availableDates[availableDates.length - 1].year;
+ // Falls der Ausweis bereits einmal gespeichert wurde mit einem Startdatum sollten wir dieses benutzen.
+ let month: number, year: number;
+ if (ausweis.startdatum) {
+ month = moment(ausweis.startdatum).get("month")
+ year = moment(ausweis.startdatum).get("year")
+ } else {
+ month = availableDates[availableDates.length - 1].month;
+ year = availableDates[availableDates.length - 1].year;
+ }
$: {
if (typeof month === "number" && typeof year === "number") {
diff --git a/src/components/Dashboard/DashboardAusweis.svelte b/src/components/Dashboard/DashboardAusweis.svelte
index d40f792b..34a1db32 100644
--- a/src/components/Dashboard/DashboardAusweis.svelte
+++ b/src/components/Dashboard/DashboardAusweis.svelte
@@ -116,7 +116,7 @@
async function stornieren() {
try {
const response = await api.admin.stornieren.PUT.fetch({
- uid_ausweis: ausweis.id
+ ausweis_id: ausweis.id
}, {
headers: {
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
@@ -143,7 +143,7 @@
}
}
- async function ausstellen() {
+ async function ausstellen(post = false) {
const notification = addNotification({
message: "Ausweis wird ausgestellt.",
subtext: "Der Ausweis wird nun ausgestellt, bitte habe einen Augenblick geduld..",
@@ -152,7 +152,8 @@
})
try {
await api.admin.ausstellen.GET.fetch({
- id_ausweis: ausweis.id
+ id_ausweis: ausweis.id,
+ post
}, {
headers: {
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
@@ -386,9 +387,10 @@
{/if}
{#if benutzer.rolle === Enums.BenutzerRolle.ADMIN}
-
-
-
+
+
+
+
{/if}
= {
BEHEIZT: "beheizt",
NICHT_VORHANDEN: "nicht vorhanden",
@@ -70,9 +62,10 @@ export async function pdfDatenblattVerbrauchsausweisGewerbe(ausweis: Verbrauchsa
}
const layout = xml2pdf(`
- ${benutzer.vorname} ${benutzer.name}
- ${benutzer.adresse}
- ${benutzer.plz} ${benutzer.ort}
+ ${rechnung?.versand_empfaenger || ""}
+ ${rechnung?.versand_zusatzzeile || ""}
+ ${rechnung?.versand_strasse || ""}
+ ${rechnung?.versand_plz || ""} ${rechnung?.versand_ort || ""}
Datenblatt Energieausweis
Ausweis ID: ${ausweis.id}
diff --git a/src/lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.ts b/src/lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.ts
index 9afa1bcf..e06f78cf 100644
--- a/src/lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.ts
+++ b/src/lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.ts
@@ -1,16 +1,15 @@
-import { AufnahmeClient, BenutzerClient, BildClient, ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
-import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
+import { AufnahmeClient, BildClient, ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
import * as fs from "fs"
import { PDFDocument, StandardFonts } from "pdf-lib";
import { xml2pdf } from "./elements/xml2pdf.js";
import moment from "moment";
-import { Enums, Heizungsstatus } from "#lib/server/prisma.js";
+import { Enums, Heizungsstatus, Rechnung } from "#lib/server/prisma.js";
import { copyPage } from "./utils/copyPage.js";
import { endEnergieVerbrauchVerbrauchsausweis_2016_Server } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016_Server.js";
/* -------------------------------- Pdf Tools ------------------------------- */
-export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohnenClient, aufnahme: AufnahmeClient, objekt: ObjektClient, benutzer: BenutzerClient, bilder: BildClient[]) {
+export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohnenClient, aufnahme: AufnahmeClient, objekt: ObjektClient, rechnung: Rechnung | null, bilder: BildClient[]) {
const VerbrauchsausweisWohnenGEG2024PDF = fs.readFileSync(new URL("../../../public/pdf/templates/Leerseite_Datenblatt.pdf", import.meta.url), "base64");
const pdf = await PDFDocument.load(VerbrauchsausweisWohnenGEG2024PDF)
const page3 = copyPage(pdf.getPages()[0]);
@@ -34,15 +33,6 @@ export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: Verbrauchsau
const marginX = 60;
const marginY = 150;
- benutzer = benutzer || {
- firma: "Max Mustermann GmbH",
- vorname: "Max",
- name: "Mustermann",
- adresse: "Musterstraße 123",
- plz: "12345",
- ort: "Beispielhausen"
- };
-
const translateHeizungsstatus: Record = {
BEHEIZT: "beheizt",
NICHT_VORHANDEN: "nicht vorhanden",
@@ -54,9 +44,10 @@ export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: Verbrauchsau
const id = ausweis.id;
const layout = xml2pdf(`
- ${benutzer.firma}
- ${benutzer.adresse}
- ${benutzer.plz} ${benutzer.ort}
+ ${rechnung?.versand_empfaenger || ""}
+ ${rechnung?.versand_zusatzzeile || ""}
+ ${rechnung?.versand_strasse || ""}
+ ${rechnung?.versand_plz || ""} ${rechnung?.versand_ort || ""}
Datenblatt Energieausweis
Ausweis ID: ${id}
diff --git a/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts b/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts
index 5f95f4b9..9cb0ce00 100644
--- a/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts
+++ b/src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts
@@ -305,17 +305,6 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
width: pfeilWidth,
height: 30
})
- const endEnergieVerbrauchGesamt = Math.round(berechnungen?.endEnergieVerbrauchGesamt ?? 0);
- const MaxvergleichsWertWaerme = Math.round(berechnungen?.vergleichsWertWaerme * 2);
- const MaxvergleichsWertWaermeText = `> ${MaxvergleichsWertWaerme.toString()}`;
- const MaxvergleichswertStrom = Math.round(berechnungen?.vergleichsWertStrom * 2);
- const MaxvergleichswertStromText = `> ${Math.round(MaxvergleichswertStrom).toString()}`;
- const endEnergieVerbrauchGesamtText = `${endEnergieVerbrauchGesamt.toString()}kWh/(m²a)`;
- const stromVerbrauchGesamtText = `${Math.round(berechnungen?.endEnergieVerbrauchStrom ?? 0).toString()}kWh/(m²a)`;
- const vergleichswertWaermeText = `${Math.round(berechnungen?.vergleichsWertWaerme).toString()}kWh/(m²a)`
- const vergleichswertWaermeText2 = `${Math.round(berechnungen?.vergleichsWertWaerme).toString()}`
- const vergleichswertStromText = `${Math.round(berechnungen?.vergleichsWertStrom).toString()}kWh/(m²a)`
- const vergleichswertStromText2 = `${Math.round(berechnungen?.vergleichsWertStrom).toString()}`
page.drawText("0", {
x: 85,
@@ -324,6 +313,8 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
font: bold
})
+ const vergleichswertWaermeText2 = `${Math.round(berechnungen?.vergleichsWertWaerme).toString()}`
+
page.drawText(vergleichswertWaermeText2, {
x: 295,
y: height - 241,
@@ -331,7 +322,9 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
font: bold
})
- page.drawText(MaxvergleichsWertWaermeText, {
+ const maxVergleichswertWaermeText = `> ${Math.round(berechnungen?.vergleichsWertWaerme * 2).toString()}`;
+
+ page.drawText(maxVergleichswertWaermeText, {
x: vergleichsWertWaermeTranslationX * 2 - 78,
y: height - 241,
size: 13,
@@ -345,6 +338,8 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
font: bold
})
+ const vergleichswertStromText2 = `${Math.round(berechnungen?.vergleichsWertStrom).toString()}`
+
page.drawText(vergleichswertStromText2, {
x: 295,
y: height - 385,
@@ -352,13 +347,16 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
font: bold
})
- page.drawText(MaxvergleichswertStromText, {
+ const maxVergleichswertStromText = `> ${Math.round(berechnungen?.vergleichsWertStrom * 2).toString()}`;
+
+ page.drawText(maxVergleichswertStromText, {
x: vergleichsWertStromTranslationX * 2 - 78,
y: height - 385,
size: 13,
font: bold
})
+ const endEnergieVerbrauchGesamtText = `${Math.round(berechnungen?.endEnergieVerbrauchGesamt ?? 0).toString()}kWh/(m²a)`;
if (endenergieverbrauchTranslationPercentage > 0.5) {
page.drawText("Endenergieverbrauch Wärme", {
@@ -387,6 +385,8 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
})
}
+ const vergleichswertWaermeText = `${Math.round(berechnungen?.vergleichsWertWaerme).toString()}kWh/(m²a)`
+
if (vergleichsWertWaermeTranslationPercentage > 0.5) {
page.drawText("Vergleichswert Wärme", {
x: vergleichsWertWaermeTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Wärme", 10),
@@ -428,6 +428,8 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
height: 30
})
+ const stromVerbrauchGesamtText = `${Math.round(berechnungen?.endEnergieVerbrauchStrom ?? 0).toString()}kWh/(m²a)`;
+
if (stromVerbrauchTranslationPercentage > 0.5) {
page.drawText("Endenergieverbrauch Strom", {
x: stromVerbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Strom", 10),
@@ -455,6 +457,9 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
})
}
+ const vergleichswertStromText = `${Math.round(berechnungen?.vergleichsWertStrom).toString()}kWh/(m²a)`
+
+
if (vergleichsWertWaermeTranslationPercentage > 0.5) {
page.drawText("Vergleichswert Strom", {
x: vergleichsWertStromTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Strom", 10),
diff --git a/src/lib/server/ausweis.ts b/src/lib/server/ausweis.ts
index d92a1896..7fb2b98c 100644
--- a/src/lib/server/ausweis.ts
+++ b/src/lib/server/ausweis.ts
@@ -3,7 +3,7 @@ import { pdfDatenblattVerbrauchsausweisGewerbe } from "#lib/pdf/pdfDatenblattVer
import { pdfDatenblattVerbrauchsausweisWohnen } from "#lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.js";
import { pdfVerbrauchsausweisGewerbe } from "#lib/pdf/pdfVerbrauchsausweisGewerbe.js";
import { pdfVerbrauchsausweisWohnen } from "#lib/pdf/pdfVerbrauchsausweisWohnen.js";
-import { Enums, prisma } from "#lib/server/prisma.js";
+import { Enums, prisma, Rechnung } 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.
@@ -49,15 +49,15 @@ export async function getAnsichtsausweis(ausweis: VerbrauchsausweisWohnenClient
* Gibt das richtige Datenblatt basierend auf der Ausweisart zurück.
* @param ausweis
*/
-export async function getDatenblatt(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient, aufnahme: AufnahmeClient, objekt: ObjektClient, bilder: BildClient[], user: BenutzerClient, ausweisart = getAusweisartFromId(ausweis.id)) {
+export async function getDatenblatt(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient, aufnahme: AufnahmeClient, objekt: ObjektClient, bilder: BildClient[], user: BenutzerClient, rechnung: Rechnung, ausweisart = getAusweisartFromId(ausweis.id)) {
if (!ausweisart) {
return null
}
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
- return await pdfDatenblattVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, user, bilder)
+ return await pdfDatenblattVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, rechnung, bilder)
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
- return await pdfDatenblattVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, user, bilder)
+ return await pdfDatenblattVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, rechnung, bilder)
}
return null
diff --git a/src/lib/server/db.ts b/src/lib/server/db.ts
index 8f7554c3..5052588a 100644
--- a/src/lib/server/db.ts
+++ b/src/lib/server/db.ts
@@ -1,4 +1,4 @@
-import { Aufnahme, BedarfsausweisGewerbe, BedarfsausweisWohnen, Bild, GEGNachweisGewerbe, GEGNachweisWohnen, Objekt, prisma, Unterlage, VerbrauchsausweisGewerbe, VerbrauchsausweisWohnen } from "./prisma.js";
+import { Aufnahme, BedarfsausweisGewerbe, BedarfsausweisWohnen, Bild, GEGNachweisGewerbe, GEGNachweisWohnen, Objekt, prisma, Rechnung, Unterlage, VerbrauchsausweisGewerbe, VerbrauchsausweisWohnen } from "./prisma.js";
export async function getVerbrauchsausweisWohnen(id: string): Promise {
return await prisma.verbrauchsausweisWohnen.findUnique({
@@ -24,6 +24,7 @@ export async function getVerbrauchsausweisWohnenKomplett(id: string) {
},
},
},
+ rechnung: true
},
})
}
@@ -54,6 +55,7 @@ export async function getVerbrauchsausweisGewerbeKomplett(id: string) {
},
},
},
+ rechnung: true
},
})
}
@@ -82,6 +84,7 @@ export async function getBedarfsausweisWohnenKomplett(id: string) {
},
},
},
+ rechnung: true
},
})
}
@@ -140,4 +143,12 @@ export async function getUnterlagen(aufnahme_id: string): Promise {
aufnahme_id
}
})
+}
+
+export async function getRechnung(rechnung_id: string) {
+ return await prisma.rechnung.findUnique({
+ where: {
+ id: rechnung_id
+ }
+ })
}
\ No newline at end of file
diff --git a/src/modules/BedarfsausweisWohnen/BedarfsausweisWohnenModule.svelte b/src/modules/BedarfsausweisWohnen/BedarfsausweisWohnenModule.svelte
index 1c1a25e4..4b69adb1 100644
--- a/src/modules/BedarfsausweisWohnen/BedarfsausweisWohnenModule.svelte
+++ b/src/modules/BedarfsausweisWohnen/BedarfsausweisWohnenModule.svelte
@@ -190,7 +190,7 @@
>
-
+ >
-
+
@@ -239,7 +239,7 @@
-
-
-
-{#if user.rolle === Enums.BenutzerRolle.ADMIN}
-
-{/if}