3
Makefile
3
Makefile
@@ -30,6 +30,9 @@ run-database: stop-database
|
|||||||
docker volume create $(DB_VOLUME)
|
docker volume create $(DB_VOLUME)
|
||||||
docker build -t $(DB_CONTAINER_NAME) .
|
docker build -t $(DB_CONTAINER_NAME) .
|
||||||
docker run -d --name $(DB_CONTAINER_NAME) \
|
docker run -d --name $(DB_CONTAINER_NAME) \
|
||||||
|
--log-driver=json-file \
|
||||||
|
--log-opt max-size=50m \
|
||||||
|
--log-opt max-file=3 \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
-e POSTGRES_USER=$(DB_USER) \
|
-e POSTGRES_USER=$(DB_USER) \
|
||||||
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
|
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const createCaller = createCallerFactory({
|
|||||||
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
||||||
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
||||||
"unterlage": await import("../src/pages/api/unterlage.ts"),
|
"unterlage": await import("../src/pages/api/unterlage.ts"),
|
||||||
|
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
||||||
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
|
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
|
||||||
"admin/bedarfsausweis-ausstellen": await import("../src/pages/api/admin/bedarfsausweis-ausstellen.ts"),
|
"admin/bedarfsausweis-ausstellen": await import("../src/pages/api/admin/bedarfsausweis-ausstellen.ts"),
|
||||||
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
|
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
|
||||||
@@ -13,7 +14,6 @@ export const createCaller = createCallerFactory({
|
|||||||
"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"),
|
||||||
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
||||||
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
|
||||||
"auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
|
"auth/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"),
|
||||||
@@ -26,20 +26,20 @@ export const createCaller = createCallerFactory({
|
|||||||
"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/[id]": await import("../src/pages/api/geg-nachweis-wohnen/[id].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-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
|
||||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
|
||||||
"rechnung/[id]": await import("../src/pages/api/rechnung/[id].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"),
|
"objekt": await import("../src/pages/api/objekt/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"),
|
||||||
|
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
||||||
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"),
|
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"),
|
||||||
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
|
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
|
||||||
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
||||||
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
||||||
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
"objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"),
|
||||||
"aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.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]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
|
||||||
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
||||||
"objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"),
|
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||||
})
|
})
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
import { dialogs } from "svelte-dialogs";
|
import { dialogs } from "svelte-dialogs";
|
||||||
import TicketPopup from "./TicketPopup.svelte";
|
import TicketPopup from "./TicketPopup.svelte";
|
||||||
import { addNotification } from "@ibcornelsen/ui";
|
import { addNotification } from "@ibcornelsen/ui";
|
||||||
|
export let userEmail: string = "";
|
||||||
|
|
||||||
async function showTicketPopup() {
|
async function showTicketPopup() {
|
||||||
const success = await dialogs.modal(TicketPopup);
|
const success = await dialogs.modal(TicketPopup, { email: userEmail });
|
||||||
|
|
||||||
console.log(success);
|
console.log(success);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { api } from "astro-typesafe-api/client";
|
import { api } from "astro-typesafe-api/client";
|
||||||
import { getClose } from "svelte-dialogs";
|
import { getClose } from "svelte-dialogs";
|
||||||
|
export let email: string = "";
|
||||||
|
|
||||||
const close = getClose();
|
const close = getClose();
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
let category = "";
|
let category = "";
|
||||||
let title = "";
|
let title = "";
|
||||||
let description = "";
|
let description = "";
|
||||||
let email = "";
|
//let email = "";
|
||||||
let telefon = "";
|
let telefon = "";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,7 @@
|
|||||||
<div class="input-standard">
|
<div class="input-standard">
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
|
accept="image/*"
|
||||||
class="file-input file-input-ghost h-[38px]"
|
class="file-input file-input-ghost h-[38px]"
|
||||||
bind:this={fileUpload}
|
bind:this={fileUpload}
|
||||||
{name}
|
{name}
|
||||||
@@ -144,6 +145,7 @@
|
|||||||
<div class="input-standard">
|
<div class="input-standard">
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
|
accept="image/*"
|
||||||
class="file-input file-input-ghost h-[38px]"
|
class="file-input file-input-ghost h-[38px]"
|
||||||
bind:this={fileUpload}
|
bind:this={fileUpload}
|
||||||
{name}
|
{name}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
|
|
||||||
<Footer />
|
<Footer />
|
||||||
<NotificationWrapper client:load />
|
<NotificationWrapper client:load />
|
||||||
<TicketButton client:load></TicketButton>
|
<TicketButton client:load userEmail={user?.email ?? ""}></TicketButton>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ export const GET = defineApiRoute({
|
|||||||
})),
|
})),
|
||||||
output: z.array(BenutzerSchema),
|
output: z.array(BenutzerSchema),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, admin) {
|
async fetch(input, context, benutzer) {
|
||||||
if ("id" in input) {
|
if ("id" in input) {
|
||||||
//Only Admin can read other users
|
// Nur Admins oder der Benutzer selbst kann einen einzelnen Benutzer lesen
|
||||||
if (admin.rolle != Enums.BenutzerRolle.ADMIN && input.id != admin.id) {
|
if (benutzer.rolle != Enums.BenutzerRolle.ADMIN && input.id != benutzer.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
return [user];
|
return [user];
|
||||||
} else {
|
} else {
|
||||||
//Only admin can read many users
|
// Nur Admins können nach mehreren Benutzern suchen
|
||||||
if (admin.rolle != Enums.BenutzerRolle.ADMIN ) {
|
if (benutzer.rolle != Enums.BenutzerRolle.ADMIN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +114,12 @@ export const PUT = defineApiRoute({
|
|||||||
id: IDWithPrefix
|
id: IDWithPrefix
|
||||||
}),
|
}),
|
||||||
async fetch(input) {
|
async fetch(input) {
|
||||||
|
let { email, passwort, vorname, name } = input;
|
||||||
|
email = email.toLowerCase();
|
||||||
|
|
||||||
const existingUser = await prisma.benutzer.findUnique({
|
const existingUser = await prisma.benutzer.findUnique({
|
||||||
where: {
|
where: {
|
||||||
email: input.email
|
email
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -131,10 +134,10 @@ export const PUT = defineApiRoute({
|
|||||||
|
|
||||||
const user = await prisma.benutzer.create({
|
const user = await prisma.benutzer.create({
|
||||||
data: {
|
data: {
|
||||||
email: input.email,
|
email,
|
||||||
passwort: hashPassword(input.passwort),
|
passwort: hashPassword(passwort),
|
||||||
vorname: input.vorname,
|
vorname,
|
||||||
name: input.name,
|
name,
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user