Update main #568
3
Makefile
3
Makefile
@@ -30,6 +30,9 @@ run-database: stop-database
|
||||
docker volume create $(DB_VOLUME)
|
||||
docker build -t $(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 \
|
||||
-e POSTGRES_USER=$(DB_USER) \
|
||||
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
|
||||
|
||||
@@ -5,6 +5,7 @@ export const createCaller = createCallerFactory({
|
||||
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
||||
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
||||
"unterlage": await import("../src/pages/api/unterlage.ts"),
|
||||
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
||||
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
|
||||
"admin/bedarfsausweis-ausstellen": await import("../src/pages/api/admin/bedarfsausweis-ausstellen.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/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
|
||||
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
||||
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
||||
"auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
|
||||
"auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
|
||||
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
|
||||
@@ -26,20 +26,20 @@ export const createCaller = createCallerFactory({
|
||||
"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": 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/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"),
|
||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
||||
"user": await import("../src/pages/api/user/index.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": 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"),
|
||||
"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]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
|
||||
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
||||
"objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"),
|
||||
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||
})
|
||||
@@ -42,6 +42,8 @@ const brennstoffe: [
|
||||
["Fernwärme HKW FB", "kWh", 1.0, 1.3, 0.4],
|
||||
["Fernwärme HKW EB", "kWh", 1.0, 0.1, 0.06],
|
||||
["Fernwärme Hamburg", "kWh", 1.0, 0.33, 0.064],
|
||||
["Fernwärme Erfurt", "kWh", 1.0, 0.3, 0],
|
||||
["Fernwärme Neumünster", "kWh", 1.0, 0.28, 0.0133],
|
||||
["Erdgas", "kWh", 1.0, 1.1, 0.24],
|
||||
["Heizöl", "kWh", 1.0, 1.1, 0.31],
|
||||
["Heizöl", "l", 10.0, 1.1, 0.31],
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
import { dialogs } from "svelte-dialogs";
|
||||
import TicketPopup from "./TicketPopup.svelte";
|
||||
import { addNotification } from "@ibcornelsen/ui";
|
||||
export let userEmail: string = "";
|
||||
|
||||
async function showTicketPopup() {
|
||||
const success = await dialogs.modal(TicketPopup);
|
||||
const success = await dialogs.modal(TicketPopup, { email: userEmail });
|
||||
|
||||
console.log(success);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
import { getClose } from "svelte-dialogs";
|
||||
export let email: string = "";
|
||||
|
||||
const close = getClose();
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
let category = "";
|
||||
let title = "";
|
||||
let description = "";
|
||||
let email = "";
|
||||
//let email = "";
|
||||
let telefon = "";
|
||||
</script>
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
<div class="input-standard">
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
class="file-input file-input-ghost h-[38px]"
|
||||
bind:this={fileUpload}
|
||||
{name}
|
||||
@@ -144,6 +145,7 @@
|
||||
<div class="input-standard">
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
class="file-input file-input-ghost h-[38px]"
|
||||
bind:this={fileUpload}
|
||||
{name}
|
||||
|
||||
@@ -150,7 +150,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
|
||||
<Footer />
|
||||
<NotificationWrapper client:load />
|
||||
<TicketButton client:load></TicketButton>
|
||||
<TicketButton client:load userEmail={user?.email ?? ""}></TicketButton>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -65,10 +65,10 @@ export const GET = defineApiRoute({
|
||||
})),
|
||||
output: z.array(BenutzerSchema),
|
||||
middleware: authorizationMiddleware,
|
||||
async fetch(input, context, admin) {
|
||||
async fetch(input, context, benutzer) {
|
||||
if ("id" in input) {
|
||||
//Only Admin can read other users
|
||||
if (admin.rolle != Enums.BenutzerRolle.ADMIN && input.id != admin.id) {
|
||||
// Nur Admins oder der Benutzer selbst kann einen einzelnen Benutzer lesen
|
||||
if (benutzer.rolle != Enums.BenutzerRolle.ADMIN && input.id != benutzer.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ export const GET = defineApiRoute({
|
||||
|
||||
return [user];
|
||||
} else {
|
||||
//Only admin can read many users
|
||||
if (admin.rolle != Enums.BenutzerRolle.ADMIN ) {
|
||||
// Nur Admins können nach mehreren Benutzern suchen
|
||||
if (benutzer.rolle != Enums.BenutzerRolle.ADMIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,9 +114,12 @@ export const PUT = defineApiRoute({
|
||||
id: IDWithPrefix
|
||||
}),
|
||||
async fetch(input) {
|
||||
let { email, passwort, vorname, name } = input;
|
||||
email = email.toLowerCase();
|
||||
|
||||
const existingUser = await prisma.benutzer.findUnique({
|
||||
where: {
|
||||
email: input.email
|
||||
email
|
||||
}
|
||||
})
|
||||
|
||||
@@ -131,10 +134,10 @@ export const PUT = defineApiRoute({
|
||||
|
||||
const user = await prisma.benutzer.create({
|
||||
data: {
|
||||
email: input.email,
|
||||
passwort: hashPassword(input.passwort),
|
||||
vorname: input.vorname,
|
||||
name: input.name,
|
||||
email,
|
||||
passwort: hashPassword(passwort),
|
||||
vorname,
|
||||
name,
|
||||
id
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user