Merge remote-tracking branch 'origin/Jens' into Jens

This commit is contained in:
Jens Cornelsen
2025-02-17 11:27:28 +01:00
31 changed files with 331 additions and 183 deletions

View File

@@ -39,7 +39,7 @@ bun link @ibcornelsen/database
PERSISTENT_DIR="${HOME}/persistent/${APP_NAME}"; PERSISTENT_DIR="${HOME}/persistent/${APP_NAME}";
mkdir -p $PERSISTENT_DIR; mkdir -p $PERSISTENT_DIR;
# TODO: Wir legen hier die .env Datei an, die die SSL Zertifikate enthält. # Wir legen hier die .env Datei an, die die SSL Zertifikate enthält.
rm -f ~/$APP_NAME/.env; rm -f ~/$APP_NAME/.env;
touch ~/$APP_NAME/.env; touch ~/$APP_NAME/.env;
echo "PRIVATE_KEY=$(cat /etc/letsencrypt/live/ibcornelsen.de/privkey.pem | base64 | tr -d '\n')" >> ~/$APP_NAME/.env; echo "PRIVATE_KEY=$(cat /etc/letsencrypt/live/ibcornelsen.de/privkey.pem | base64 | tr -d '\n')" >> ~/$APP_NAME/.env;

View File

@@ -8,9 +8,9 @@ export const createCaller = createCallerFactory({
"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/forgot-password": await import("../src/pages/api/auth/forgot-password.ts"), "auth/forgot-password": await import("../src/pages/api/auth/forgot-password.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"),
"bilder/[uid]": await import("../src/pages/api/bilder/[uid].ts"),
"bedarfsausweis-wohnen/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].ts"), "bedarfsausweis-wohnen/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].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"),
"objekt": await import("../src/pages/api/objekt/index.ts"), "objekt": await import("../src/pages/api/objekt/index.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"),

View File

@@ -5,7 +5,7 @@
//import Label from "#components/Label.svelte"; //import Label from "#components/Label.svelte";
import { auditHeizungGebaeudeBaujahr } from "../Verbrauchsausweis/audits/HeizungGebaeudeBaujahr.js"; import { auditHeizungGebaeudeBaujahr } from "../Verbrauchsausweis/audits/HeizungGebaeudeBaujahr.js";
import { addNotification, deleteNotification } from "@ibcornelsen/ui"; import { addNotification, deleteNotification } from "#components/Notifications/shared.js";
import TagInput from "../TagInput.svelte"; import TagInput from "../TagInput.svelte";
import { Enums } from "@ibcornelsen/database/client"; import { Enums } from "@ibcornelsen/database/client";
import { import {

View File

@@ -86,22 +86,6 @@
} }
} }
$: {
console.log(month, year);
if ((availableDates.filter(date => date.month === month && date.year === year).length === 0) && typeof month === "number" && typeof year === "number") {
addNotification({
message: "Monat nicht verfügbar.",
subtext: "Der ausgewählte Monat ist in diesem Jahr nicht verfügbar, bitte wählen sie einen neuen Start Monat.",
dismissable: true,
type: "warning",
timeout: 0,
uid: "monat_nicht_verfuegbar",
selector: "select[name='energieverbrauch_zeitraum_monat']"
})
}
}
$: abweichung = auditVerbrauchAbweichung(ausweis, aufnahme); $: abweichung = auditVerbrauchAbweichung(ausweis, aufnahme);
</script> </script>

View File

@@ -11,7 +11,6 @@
ObjektClient, ObjektClient,
VerbrauchsausweisWohnenClient, VerbrauchsausweisWohnenClient,
} from "./types.js"; } from "./types.js";
import { addNotification } from "#components/Notifications/shared.js";
export let objekt: ObjektClient; export let objekt: ObjektClient;
export let aufnahme: AufnahmeClient; export let aufnahme: AufnahmeClient;
@@ -20,6 +19,7 @@
// Wir dürfen bis zu 4.5 Jahre alte Klimafaktoren benutzen, also nehmen wir alle Monate seitdem und generieren daraus die Auswahl. // Wir dürfen bis zu 4.5 Jahre alte Klimafaktoren benutzen, also nehmen wir alle Monate seitdem und generieren daraus die Auswahl.
// Allerdings müssen wir auch berücksichtigen, dass wir drei folgende Jahre brauchen, also // Allerdings müssen wir auch berücksichtigen, dass wir drei folgende Jahre brauchen, also
// kann der Nutzer nur 36 + 18 Monate zurückgehen. // kann der Nutzer nur 36 + 18 Monate zurückgehen.
let availableDates: { let availableDates: {
year: number; year: number;
month: number; month: number;
@@ -62,8 +62,8 @@
fuelMap[fuel[0]].push(fuel[1]); fuelMap[fuel[0]].push(fuel[1]);
} }
let month = ausweis.startdatum?.getMonth(); let month = moment(ausweis.startdatum).month();
let year = ausweis.startdatum?.getFullYear(); let year = moment(ausweis.startdatum).year();
$: { $: {
if (typeof month === "number" && typeof year === "number") { if (typeof month === "number" && typeof year === "number") {
@@ -78,29 +78,6 @@
} }
} }
$: {
console.log(month, year);
if (
availableDates.filter(
(date) => date.month === month && date.year === year
).length === 0 &&
typeof month === "number" &&
typeof year === "number"
) {
addNotification({
message: "Monat nicht verfügbar.",
subtext:
"Der ausgewählte Monat ist in diesem Jahr nicht verfügbar, bitte wählen sie einen neuen Start Monat.",
dismissable: true,
type: "warning",
timeout: 0,
uid: "monat_nicht_verfuegbar",
selector: "select[name='energieverbrauch_zeitraum_monat']",
});
}
}
$: abweichung = auditVerbrauchAbweichung(ausweis, aufnahme); $: abweichung = auditVerbrauchAbweichung(ausweis, aufnahme);
</script> </script>

View File

@@ -2,27 +2,31 @@
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js"; import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
import moment from "moment"; import moment from "moment";
import { import {
AufnahmeClient,
getAusweisartFromUUID,
ObjektClient,
UploadedGebaeudeBild,
VerbrauchsausweisWohnenClient, VerbrauchsausweisWohnenClient,
} from "./Ausweis/types.js"; } from "./Ausweis/types.js";
import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte"; import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte";
import { addNotification } from "./NotificationProvider/shared.js"; import { addNotification } from "./NotificationProvider/shared.js";
import { CheckCircled, CrossCircled, Image } from "radix-svelte-icons"; import { CheckCircled, CrossCircled, Image } from "radix-svelte-icons";
import ChevronDown from "radix-svelte-icons/src/lib/icons/ChevronDown.svelte"; import ChevronDown from "radix-svelte-icons/src/lib/icons/ChevronDown.svelte";
import { Event } from "@ibcornelsen/database/client";
export let ausweis: VerbrauchsausweisWohnenClient; export let ausweis: VerbrauchsausweisWohnenClient;
export let aufnahme: AufnahmeClient;
export let objekt: ObjektClient;
export let bilder: UploadedGebaeudeBild[]
export let events: Event[]
export let calculations: Awaited< export let calculations: Awaited<
ReturnType<typeof endEnergieVerbrauchVerbrauchsausweis_2016> ReturnType<typeof endEnergieVerbrauchVerbrauchsausweis_2016>
>; >;
console.log(ausweis);
const aufnahme = ausweis.aufnahme
const ausweisArt = "VA"; // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen const ausweisArt = getAusweisartFromUUID(ausweis.uid) // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen
const images = ausweis.aufnahme.objekt.gebaeude_bilder;
let verbrauchWWGesamt_1 = ""; let verbrauchWWGesamt_1 = "";
let verbrauchWWGesamt_2 = ""; let verbrauchWWGesamt_2 = "";
@@ -145,13 +149,13 @@
) { ) {
if (aufnahme.solarsystem_warmwasser) { if (aufnahme.solarsystem_warmwasser) {
// Wenn Warmwasser enthalten und Anteil bekannt und Solarsystem // Wenn Warmwasser enthalten und Anteil bekannt und Solarsystem
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${ausweis.anteil_warmwasser_1 / 100} x 0.6`; verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${(ausweis.anteil_warmwasser_1 || 0) / 100} x 0.6`;
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${ausweis.anteil_warmwasser_2 / 100} x 0.6`; verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${(ausweis.anteil_warmwasser_2 || 0) / 100} x 0.6`;
solarsystemWarmwasser = "Solarsystem Warmwasser"; solarsystemWarmwasser = "Solarsystem Warmwasser";
} else { } else {
// Wenn Warmwasser enthalten und Anteil bekannt und **kein** Solarsystem // Wenn Warmwasser enthalten und Anteil bekannt und **kein** Solarsystem
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${ausweis.anteil_warmwasser_1 / 100} x 0.6` verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${(ausweis.anteil_warmwasser_1 || 0) / 100} x 0.6`
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${ausweis.anteil_warmwasser_2 / 100} x 0.6` verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${(ausweis.anteil_warmwasser_2 || 0) / 100} x 0.6`
solarsystemWarmwasser = "kein Solarsystem Warmwasser"; solarsystemWarmwasser = "kein Solarsystem Warmwasser";
} }
} else { } else {
@@ -674,13 +678,13 @@
<button class="btn btn-square" on:click={() => bilderModal.showModal()}><Image size={22}></Image></button> <button class="btn btn-square" on:click={() => bilderModal.showModal()}><Image size={22}></Image></button>
<dialog bind:this={bilderModal} class="modal"> <dialog bind:this={bilderModal} class="modal">
<div class="modal-box flex flex-row gap-4 items-center justify-center"> <div class="modal-box flex flex-row gap-4 items-center justify-center">
{#if images.length === 0} {#if bilder.length === 0}
<div class="flex flex-col gap-4 items-center justify-center"> <div class="flex flex-col gap-4 items-center justify-center">
<p>Für diesen Ausweis sind noch keine Bilder vorhanden.</p> <p>Für diesen Ausweis sind noch keine Bilder vorhanden.</p>
<button class="btn btn-primary" tabindex="0">Erinnerung Verschicken</button> <button class="btn btn-primary" tabindex="0">Erinnerung Verschicken</button>
</div> </div>
{:else} {:else}
{#each images as image} {#each bilder as image}
<div> <div>
<h2 class="text-lg mb-4 font-bold">{image.kategorie}</h2> <h2 class="text-lg mb-4 font-bold">{image.kategorie}</h2>
<img src="/bilder/{image.uid}.webp"> <img src="/bilder/{image.uid}.webp">
@@ -837,7 +841,7 @@
</div> </div>
<hr/> <hr/>
</li> </li>
{#each ausweis.aufnahme.events as event, i} {#each events as event, i}
<li> <li>
<hr /> <hr />
<div class="timeline-middle"> <div class="timeline-middle">

View File

@@ -1,3 +1,7 @@
<script lang="ts">
</script>
<div class="dropdown dropdown-hover dropdown-bottom"> <div class="dropdown dropdown-hover dropdown-bottom">
<div role="button" tabindex="0"> <div role="button" tabindex="0">
<slot></slot> <slot></slot>

View File

@@ -1,5 +1,7 @@
<script lang="ts"></script> <script lang="ts">
<div class="fixed right-8 bottom-8 max-w-[400px] flex flex-col gap-4 z-50"> </script>
<div class="fixed right-8 bottom-8 max-w-[400px] flex flex-col gap-4 z-50" {...$$restProps}>
<slot></slot> <slot></slot>
</div> </div>

View File

@@ -75,7 +75,7 @@
on:focusin={onFocusIn} on:focusin={onFocusIn}
on:focusout={onFocusOut} on:focusout={onFocusOut}
on:blur={() => { on:blur={() => {
if (tag.toString().length >= minlength && tag.toString().length < maxlength) { if (tag.toString().length >= minlength && tag.toString().length <= maxlength) {
addTag(tag) addTag(tag)
tag = "" tag = ""
} }

View File

@@ -1,20 +1,29 @@
import { ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js"; import {
ObjektClient,
VerbrauchsausweisWohnenClient,
} from "#components/Ausweis/types.js";
import { AuditType, hidden } from "./hidden.js"; import { AuditType, hidden } from "./hidden.js";
import { getKlimafaktoren } from "#lib/Klimafaktoren.js"; import { getKlimafaktoren } from "#lib/Klimafaktoren.js";
export async function auditKlimaFaktoren(ausweis: VerbrauchsausweisWohnenClient, gebaeude: ObjektClient): Promise<boolean> { export async function auditKlimaFaktoren(
ausweis: VerbrauchsausweisWohnenClient,
gebaeude: ObjektClient
): Promise<boolean> {
if (hidden.has(AuditType.KLIMA_FAKTOREN)) { if (hidden.has(AuditType.KLIMA_FAKTOREN)) {
return false; return false;
} }
if (ausweis.startdatum && gebaeude.plz && ausweis.verbrauch_1) { if (ausweis.startdatum && gebaeude.plz && ausweis.verbrauch_1) {
try { try {
const response = await getKlimafaktoren(ausweis.startdatum, gebaeude.plz); const response = await getKlimafaktoren(
return true; // Alle Klimfaktoren konnten abgefragt werden. ausweis.startdatum,
} catch (e) { gebaeude.plz
return true; );
return true; // Alle Klimfaktoren konnten abgefragt werden.
} catch (e) {
return true;
}
} }
}
return false; return false;
} }

View File

@@ -2,7 +2,7 @@ import { AufnahmeClient } from "#components/Ausweis/types.js";
import { AuditType, hidden } from "./hidden.js"; import { AuditType, hidden } from "./hidden.js";
export function auditLeerStand(gebaeude: AufnahmeClient): boolean { export function auditLeerStand(gebaeude: AufnahmeClient): boolean {
if (gebaeude.leerstand && !hidden.has(AuditType.LEER_STAND)) { if (gebaeude.leerstand) {
return ( return (
(gebaeude.leerstand > 30) (gebaeude.leerstand > 30)
); );

View File

@@ -1,7 +1,7 @@
import { AufnahmeClient, ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js"; import { AufnahmeClient, ObjektClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
import { AuditType, hidden } from "./hidden.js"; import { AuditType, hidden } from "./hidden.js";
export function auditVerbrauchAbweichung(ausweis: VerbrauchsausweisWohnenClient, aufnahme: AufnahmeClient): number[] { export function auditVerbrauchAbweichung(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient, aufnahme: AufnahmeClient): number[] {
if (aufnahme.leerstand && (aufnahme.leerstand > 0)) { if (aufnahme.leerstand && (aufnahme.leerstand > 0)) {
return []; return [];
} }

View File

@@ -16,21 +16,25 @@ const { title } = Astro.props;
<script> <script>
window.addEventListener("scroll", (event) => { window.addEventListener("scroll", (event) => {
let scroll = window.scrollY; let scroll = window.scrollY;
const skala = document.getElementById("skala")
console.log(scroll);
if(scroll>=400){ if(scroll>=400){
if (skala) {
document.getElementById('skala')?.classList.add('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20'); skala.classList.add('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20');
document.getElementById('skala')?.classList.remove('w-full'); skala.classList.remove('w-full');
skala.style.borderBottom = "3px solid #e6e6e6";
}
document.getElementById('skala').style.borderBottom = "3px solid #e6e6e6"; const performanceBox = document.getElementById('performance-box')
if (performanceBox) {
performanceBox.style.maxWidth = "688.5px";
}
const progressBox = document.getElementById('progress-box');
if (progressBox) {
document.getElementById('performance-box').style.maxWidth = "688.5px"; progressBox.style.maxWidth = "688.5px"
document.getElementById('progress-box').style.maxWidth = "688.5px"; }
document.getElementById('formInput-1')?.classList.add('2xl:mt-[370px]'); document.getElementById('formInput-1')?.classList.add('2xl:mt-[370px]');
@@ -38,11 +42,12 @@ console.log(scroll);
}else{ }else{
if (skala) {
skala.classList.remove('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20')
skala.classList.add('w-full')
skala.style.borderBottom = "none";
}
document.getElementById('skala')?.classList.remove('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20');
document.getElementById('skala')?.classList.add('w-full');
document.getElementById('skala').style.borderBottom = "none";
document.getElementById('formInput-1')?.classList.remove('2xl:mt-[370px]'); document.getElementById('formInput-1')?.classList.remove('2xl:mt-[370px]');

View File

@@ -15,20 +15,12 @@ if (!valid) {
Astro.redirect("/auth/login", 302) Astro.redirect("/auth/login", 302)
} }
const caller = createCaller(Astro)
const benutzer = (await caller.user.self.GET.fetch(undefined, {
headers: {
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
}
})) || {} as BenutzerClient;
export interface Props { export interface Props {
title: string; title: string;
user: BenutzerClient
} }
const { title } = Astro.props; const { title, user } = Astro.props;
const schema = JSON.stringify({ const schema = JSON.stringify({
"@context": "http://schema.org", "@context": "http://schema.org",
@@ -107,7 +99,7 @@ let lightTheme = Astro.cookies.get("theme")?.value === "light";
</head> </head>
<body class="min-h-screen grid md:grid-cols-[300px_1fr]"> <body class="min-h-screen grid md:grid-cols-[300px_1fr]">
<DashboardSidebar lightTheme={lightTheme} {benutzer} client:load></DashboardSidebar> <DashboardSidebar lightTheme={lightTheme} benutzer={user} client:load></DashboardSidebar>
<main class="p-4 md:p-8 overflow-auto h-screen bg-base-100 pt-20 md:!pt-24"> <main class="p-4 md:p-8 overflow-auto h-screen bg-base-100 pt-20 md:!pt-24">
<slot /> <slot />
</main> </main>

View File

@@ -48,13 +48,15 @@
<span class="font-semibold">Falls sie ein Konto bei uns haben wurde eine Email an sie verschickt.</span> <span class="font-semibold">Falls sie ein Konto bei uns haben wurde eine Email an sie verschickt.</span>
</div> </div>
{/if} {/if}
<button type="submit" class="btn btn-primary" <button type="submit" class="button"
>Email zum Zurücksetzen des Passworts senden.</button >Email zum Zurücksetzen des Passworts senden.</button
> >
{#if showEmailSuccess}
<div class="flex-row justify-between" style="margin-top: 10px"> <div class="flex-row justify-between" style="margin-top: 10px">
<a class="link link-hover" <a class="link link-hover"
href="/auth/login{redirect ? `?redirect=${redirect}` : ""}">Einloggen</a href="/auth/login{redirect ? `?redirect=${redirect}` : ""}">Einloggen</a
> >
</div> </div>
{/if}
</form> </form>
</div> </div>

View File

@@ -70,14 +70,9 @@
required required
/> />
</div> </div>
<button type="submit" class="btn btn-primary" <button type="submit" class="button"
>Passwort zurückzusetzen</button >Passwort zurückzusetzen</button
> >
<div class="flex-row justify-between" style="margin-top: 10px">
<a class="link link-hover"
href="/auth/login">Einloggen</a
>
</div>
</form> </form>
</div> </div>

View File

@@ -1,18 +1,31 @@
<script lang="ts"> <script lang="ts">
import { import {
AufnahmeClient,
ObjektClient,
UploadedGebaeudeBild,
VerbrauchsausweisWohnenClient, VerbrauchsausweisWohnenClient,
} from "#components/Ausweis/types"; } from "#components/Ausweis/types.js";
import AusweisPruefenBox from "#components/AusweisPruefenBox.svelte"; import AusweisPruefenBox from "#components/AusweisPruefenBox.svelte";
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte"; import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016"; import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte"; import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte";
import { Event } from "@ibcornelsen/database/client";
export let ausweise: {
ausweis: VerbrauchsausweisWohnenClient,
aufnahme: AufnahmeClient,
objekt: ObjektClient,
bilder: UploadedGebaeudeBild[],
events: Event[]
}[];
console.log(ausweise);
export let ausweise: VerbrauchsausweisWohnenClient[];
</script> </script>
<div class="gap-4 flex flex-col"> <div class="gap-4 flex flex-col">
{#each ausweise as ausweis} {#each ausweise as { ausweis, objekt, aufnahme, bilder, events }}
{#await endEnergieVerbrauchVerbrauchsausweis_2016(ausweis)} {#await endEnergieVerbrauchVerbrauchsausweis_2016(ausweis, aufnahme, objekt)}
<div class="rounded-lg border w-full h-20 p-2.5 gap-4 flex flex-row items-center"> <div class="rounded-lg border w-full h-20 p-2.5 gap-4 flex flex-row items-center">
<div class="w-1/12 h-full flex flex-col gap-2"> <div class="w-1/12 h-full flex flex-col gap-2">
<div class="skeleton w-8 h-8 rounded-full"></div> <div class="skeleton w-8 h-8 rounded-full"></div>
@@ -85,7 +98,7 @@
<div class="skeleton w-4 h-4"></div> <div class="skeleton w-4 h-4"></div>
</div> </div>
{:then calculations} {:then calculations}
<AusweisPruefenBox {ausweis} {calculations}></AusweisPruefenBox> <AusweisPruefenBox {ausweis} {aufnahme} {objekt} {bilder} {events} {calculations}></AusweisPruefenBox>
{/await} {/await}
{/each} {/each}
</div> </div>

View File

@@ -3,9 +3,6 @@
export let user: BenutzerClient; export let user: BenutzerClient;
export let objekte: ObjektClient[]; export let objekte: ObjektClient[];
console.log(objekte);
</script> </script>
<h1 class="text-4xl font-medium my-8">Willkommen zurück, {user.vorname}!</h1> <h1 class="text-4xl font-medium my-8">Willkommen zurück, {user.vorname}!</h1>

View File

@@ -10,6 +10,7 @@
import { BenutzerClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js"; import { BenutzerClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
import { PRICES } from "#lib/constants.js"; import { PRICES } from "#lib/constants.js";
import { RechnungClient } from "#components/Ausweis/types.js"; import { RechnungClient } from "#components/Ausweis/types.js";
import { api } from "astro-typesafe-api/client";
export let user: BenutzerClient; export let user: BenutzerClient;
export let ausweis: export let ausweis:
@@ -62,17 +63,21 @@
e.preventDefault(); e.preventDefault();
// TODO // TODO
const response = await client.v1.rechnungen.erstellen.mutate({ const response = await api.rechnung.PUT.fetch({
...rechnung, ...rechnung,
ausweisart: Enums.Ausweisart.VerbrauchsausweisWohnen, ausweisart: Enums.Ausweisart.VerbrauchsausweisWohnen,
uid: ausweis.uid, ausweis_uid: ausweis.uid,
bezahlmethode: selectedPaymentType, bezahlmethode: selectedPaymentType,
services: services services: services
.filter((service) => service.selected) .filter((service) => service.selected)
.map((service) => service.id), .map((service) => service.id),
}); });
window.location.href = response.checkout_url; if (selectedPaymentType === Enums.Bezahlmethoden.rechnung) {
window.location.href = `/payment/success?uid=${response.uid}`
} else {
window.location.href = response.checkout_url as string;
}
} }
const priceTotal = services.reduce((acc, service) => { const priceTotal = services.reduce((acc, service) => {

View File

@@ -5,9 +5,6 @@
import Ansprechpartner from "#components/Ausweis/Ansprechpartner.svelte"; import Ansprechpartner from "#components/Ausweis/Ansprechpartner.svelte";
import Rechnungsadresse from "#components/Ausweis/Rechnungsadresse.svelte"; import Rechnungsadresse from "#components/Ausweis/Rechnungsadresse.svelte";
import Bezahlung from "#components/Ausweis/Bezahlung.svelte"; import Bezahlung from "#components/Ausweis/Bezahlung.svelte";
import Pruefung from "#components/Ausweis/Pruefung.svelte";
import type { Bezahlmethoden } from "@ibcornelsen/database/client"; import type { Bezahlmethoden } from "@ibcornelsen/database/client";
import { Enums } from "@ibcornelsen/database/client"; import { Enums } from "@ibcornelsen/database/client";
import { dialogs } from "svelte-dialogs"; import { dialogs } from "svelte-dialogs";
@@ -24,7 +21,6 @@
} from "#components/Ausweis/types.js"; } from "#components/Ausweis/types.js";
import { validateAccessTokenClient } from "src/client/lib/validateAccessToken.js"; import { validateAccessTokenClient } from "src/client/lib/validateAccessToken.js";
import { api } from "astro-typesafe-api/client"; import { api } from "astro-typesafe-api/client";
import A10WaermequellenAnlagentechnikTrinkwarmwasser from "#components/Tabellen/A10WaermequellenAnlagentechnikTrinkwarmwasser.svelte";
export let user: BenutzerClient; export let user: BenutzerClient;
export let ausweis: VerbrauchsausweisWohnenClient; export let ausweis: VerbrauchsausweisWohnenClient;
@@ -144,12 +140,31 @@
} }
}) })
window.location.href = checkout_url; if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
window.location.href = `/payment/success?uid=${uid}`
} else {
window.location.href = checkout_url as string;
}
} catch(e) { } catch(e) {
console.log(e);
} }
} }
/**
* TODO
* Ausschlusskriterien: Neubau, Modernisierung
Baujahr vor 1978, unsaniert und bis 4 Wohneinheiten /
Heizung jünger als 3 Jahre / Verbrauchsjahre unvollständig / Verbrauchsjahre nicht aktuell genug /
Klimafaktoren unvollständig /
Leerstand größer 30% /
Fehlende oder unvollständige Bilder (pro Abschnitt mindestens ein Bild) /
Fehlende Angaben zum Sanierungsstand (Bei F mindestens 2 Haken), (Bei G mindestens 1 Haken)
*/
let bestellenNichtMoeglich = false;
if (((ausweis.ausstellgrund === "Neubau" || ausweis.ausstellgrund === "Modernisierung") && aufnahme.baujahr_gebaeude[0] < 1978 && aufnahme.saniert === false && aufnahme.einheiten && aufnahme.einheiten > 4) || (new Date().getFullYear() - aufnahme.baujahr_heizung[0] < 3) || (!ausweis.verbrauch_1 || !ausweis.verbrauch_2 || !ausweis.verbrauch_3) || (aufnahme.leerstand && aufnahme.leerstand > 30)) {
bestellenNichtMoeglich = true
}
</script> </script>
<div <div
@@ -270,7 +285,7 @@
<button class="button">Speichern</button> <button class="button">Speichern</button>
<button class="button" data-cy="bestellen" on:click={bestellen}>kostenpflichtig bestellen</button> <button class="button cursor-pointer" data-cy="bestellen" on:click={bestellen} >Kostenpflichtig bestellen</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,13 @@
<script lang="ts">
import { RechnungClient } from "#components/Ausweis/types.js";
import { Enums } from "@ibcornelsen/database/client";
export let rechnung: RechnungClient;
</script>
<h1>Bestellbestätigung</h1>
{#if rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung}
<p>Vielen Dank für Ihre Bestellung. Wir haben Ihnen soeben eine E-Mail zugeschickt. Eine Rechnung bekommen Sie nach Abschluss der Dienstleistung zugeschickt.</p>
<p>Sie haben Rechnungszahlung ausgewählt. Wir haben Ihnen in der E-Mail unsere Bankverbindung zur Überweisung des Betrages aufgeführt. Bitte denken Sie daran die Belegnummer wie aufgeführt anzugeben. Alle anderen Zahloptionen stehen Ihnen auch zur Verfügung.</p>
{/if}

View File

@@ -1,8 +1,10 @@
<script lang="ts"> <script lang="ts">
import { addNotification } from "@ibcornelsen/ui"; import { addNotification } from "#components/Notifications/shared.js";
import { CrossCircled } from "radix-svelte-icons"; import { CrossCircled } from "radix-svelte-icons";
import { fade } from "svelte/transition"; import { fade } from "svelte/transition";
import { api } from "astro-typesafe-api/client"; import { api } from "astro-typesafe-api/client";
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
import NotificationWrapper from "#components/Notifications/NotificationWrapper.svelte";
let passwort: string; let passwort: string;
let email: string; let email: string;
@@ -13,6 +15,16 @@
async function login(e: SubmitEvent) { async function login(e: SubmitEvent) {
e.preventDefault() e.preventDefault()
if (passwort.length < 8) {
addNotification({
message: "Passwort muss mindestens 6 Zeichen enthalten.",
dismissable: true,
timeout: 3000,
type: "error"
})
return;
}
try { try {
const { uid } = await api.user.PUT.fetch({ const { uid } = await api.user.PUT.fetch({
email, email,
@@ -92,7 +104,7 @@
<span class="font-semibold">Da ist wohl etwas schiefgelaufen. Diese Email Adresse ist bereits in Benutzung, haben sie vielleicht bereits ein Konto bei uns?</span> <span class="font-semibold">Da ist wohl etwas schiefgelaufen. Diese Email Adresse ist bereits in Benutzung, haben sie vielleicht bereits ein Konto bei uns?</span>
</div> </div>
{/if} {/if}
<button type="submit" class="btn btn-primary" <button type="submit" class="button"
>Registrieren</button >Registrieren</button
> >
<div class="flex-row justify-between" style="margin-top: 10px"> <div class="flex-row justify-between" style="margin-top: 10px">
@@ -102,4 +114,5 @@
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}">Passwort Vergessen?</a> <a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}">Passwort Vergessen?</a>
</div> </div>
</form> </form>
<NotificationWrapper></NotificationWrapper>
</div> </div>

View File

@@ -51,6 +51,7 @@
AufnahmeClient, AufnahmeClient,
} from "#components/Ausweis/types.js"; } from "#components/Ausweis/types.js";
import { Enums } from "@ibcornelsen/database/client"; import { Enums } from "@ibcornelsen/database/client";
import { onMount } from "svelte";
// TODO: Vom Server sollte ein volles Objekt kommen, dass alle Subobjekte enthält, weil es sonst zu Problemen führen kann // TODO: Vom Server sollte ein volles Objekt kommen, dass alle Subobjekte enthält, weil es sonst zu Problemen führen kann
// wenn aufnahme oder objekt nicht existiert... // wenn aufnahme oder objekt nicht existiert...
@@ -60,6 +61,27 @@
export let user: BenutzerClient = {} as BenutzerClient; export let user: BenutzerClient = {} as BenutzerClient;
export let bilder: UploadedGebaeudeBild[] = [] export let bilder: UploadedGebaeudeBild[] = []
if (Object.keys(ausweis).length === 0) {
const localStorageAusweis = localStorage.getItem("ausweis");
if (localStorageAusweis) {
ausweis = JSON.parse(localStorageAusweis)
}
}
if (Object.keys(aufnahme).length === 0) {
const localStorageAufnahme = localStorage.getItem("aufnahme");
if (localStorageAufnahme) {
aufnahme = JSON.parse(localStorageAufnahme)
}
}
if (Object.keys(objekt).length === 0) {
const localStorageObjekt = localStorage.getItem("objekt");
if (localStorageObjekt) {
objekt = JSON.parse(localStorageObjekt)
}
}
async function spaeterWeitermachen() { async function spaeterWeitermachen() {
// TODO FIX // TODO FIX
// const result = await ausweisSpeichern( // const result = await ausweisSpeichern(
@@ -144,6 +166,18 @@
let waitOverlayHidden = true; let waitOverlayHidden = true;
let speichernOverlayHidden = true; let speichernOverlayHidden = true;
$: {
if (ausweis.uid && objekt.uid && aufnahme.uid) {
localStorage.setItem(ausweis.uid, JSON.stringify(ausweis))
localStorage.setItem(objekt.uid, JSON.stringify(objekt))
localStorage.setItem(aufnahme.uid, JSON.stringify(aufnahme))
} else {
localStorage.setItem("ausweis", JSON.stringify(ausweis))
localStorage.setItem("aufnahme", JSON.stringify(aufnahme))
localStorage.setItem("objekt", JSON.stringify(objekt))
}
}
$: { $: {
if ( if (
aufnahme.saniert && aufnahme.saniert &&
@@ -205,7 +239,7 @@ lg:grid-cols-2 lg:gap-x-6
<form id="formInput-1" on:submit={ausweisAbschicken} name="ausweis" data-test="ausweis"> <form id="formInput-1" on:submit={ausweisAbschicken} name="ausweis" data-test="ausweis">
<div id="formular-box" class="formular-boxen ring-0"> <div id="formular-box" class="formular-boxen ring-0">
<!--<ButtonSpaeterHilfe {automatischAusfüllen} {spaeterWeitermachen} />--> <ButtonSpaeterHilfe {automatischAusfüllen} {spaeterWeitermachen} />
<!-- A Prüfung der Ausweisart --> <!-- A Prüfung der Ausweisart -->
@@ -302,7 +336,7 @@ lg:grid-cols-2 lg:gap-x-6
> >
</div> </div>
<ButtonWeiterHilfe {spaeterWeitermachen} <ButtonWeiterHilfe
bind:ausweis bind:ausweis
bind:bilder bind:bilder
bind:user bind:user
@@ -317,7 +351,7 @@ lg:grid-cols-2 lg:gap-x-6
</form> </form>
<RawNotificationWrapper> <RawNotificationWrapper class="fixed left-8 bottom-8 max-w-[400px] flex flex-col gap-4 z-50">
{#each Object.entries($notifications) as [uid, notification] (uid)} {#each Object.entries($notifications) as [uid, notification] (uid)}
<RawNotification notification={{ ...notification, uid }}> <RawNotification notification={{ ...notification, uid }}>
{@html notification.subtext} {@html notification.subtext}
@@ -416,7 +450,8 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true, dismissable: true,
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.HEIZUNG_JUENGER_DREI_JAHRE); hidden.add(AuditType.HEIZUNG_JUENGER_DREI_JAHRE);
objekt = objekt; aufnahme = aufnahme;
}, },
type: "warning", type: "warning",
}} }}
@@ -440,6 +475,7 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.ZEITRAUM_AKTUELL); hidden.add(AuditType.ZEITRAUM_AKTUELL);
objekt = objekt; objekt = objekt;
ausweis = ausweis
}, },
type: "warning", type: "warning",
}} }}
@@ -463,6 +499,7 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.KLIMA_FAKTOREN); hidden.add(AuditType.KLIMA_FAKTOREN);
objekt = objekt; objekt = objekt;
ausweis = ausweis;
}, },
type: "warning", type: "warning",
}} }}
@@ -486,7 +523,7 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true, dismissable: true,
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.WOHN_FLAECHE); hidden.add(AuditType.WOHN_FLAECHE);
objekt = objekt; aufnahme = aufnahme;
}, },
type: "warning", type: "warning",
}} }}
@@ -506,7 +543,7 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true, dismissable: true,
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.WARM_WASSER); hidden.add(AuditType.WARM_WASSER);
objekt = objekt; ausweis = ausweis;
}, },
type: "warning", type: "warning",
}} }}
@@ -522,11 +559,7 @@ lg:grid-cols-2 lg:gap-x-6
message: "Plausibilitätsprüfung", message: "Plausibilitätsprüfung",
timeout: 0, timeout: 0,
uid: "LEER_STAND", uid: "LEER_STAND",
dismissable: true, dismissable: false,
onUserDismiss: () => {
hidden.add(AuditType.LEER_STAND);
objekt = objekt;
},
type: "warning", type: "warning",
}} }}
> >
@@ -536,7 +569,8 @@ lg:grid-cols-2 lg:gap-x-6
</RawNotification> </RawNotification>
{/if} {/if}
{#if auditVerbrauchAbweichung(ausweis, aufnahme).length > 0} {@const abweichung = auditVerbrauchAbweichung(ausweis, aufnahme)}
{#if abweichung.length > 0}
<RawNotification <RawNotification
notification={{ notification={{
message: "Plausibilitätsprüfung", message: "Plausibilitätsprüfung",
@@ -546,17 +580,12 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => { onUserDismiss: () => {
hidden.add(AuditType.VERBRAUCH_ABWEICHUNG); hidden.add(AuditType.VERBRAUCH_ABWEICHUNG);
objekt = objekt; objekt = objekt;
ausweis = ausweis;
}, },
type: "warning", type: "warning",
}} }}
> >
Die Abweichung der Verbräuche zwischen Zeitraum {auditVerbrauchAbweichung( Die Abweichung der Verbräuche zwischen Zeitraum {abweichung[0]} und {abweichung[1]} beträgt mehr als 30% und sie haben keinen Leerstand angegeben.
ausweis,
aufnahme
)[0]} und {auditVerbrauchAbweichung(
ausweis,
aufnahme
)[1]} beträgt mehr als 30% und sie haben keinen Leerstand angegeben.
Sind sie sich sicher, dass das stimmt? Sind sie sich sicher, dass das stimmt?
</RawNotification> </RawNotification>
{/if} {/if}

View File

@@ -37,7 +37,7 @@ export const PUT = defineApiRoute({
}) })
), ),
output: z.object({ output: z.object({
checkout_url: z.string(), checkout_url: z.string().optional(),
uid: UUidWithPrefix, uid: UUidWithPrefix,
}), }),
headers: authorizationHeaders, headers: authorizationHeaders,
@@ -113,6 +113,10 @@ export const PUT = defineApiRoute({
}); });
} }
if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
return { uid: rechnung.uid }
}
// Wir erstellen eine Mollie Payment Referenz. // Wir erstellen eine Mollie Payment Referenz.
const payment = await mollieClient.payments.create({ const payment = await mollieClient.payments.create({
amount: { amount: {

View File

@@ -7,7 +7,7 @@ import { z } from "zod";
export const PUT = defineApiRoute({ export const PUT = defineApiRoute({
input: z.object({ input: z.object({
email: z.string().email(), email: z.string().email(),
passwort: z.string().min(6), passwort: z.string().min(8),
vorname: z.string(), vorname: z.string(),
name: z.string() name: z.string()
}), }),

View File

@@ -1,31 +1,54 @@
import { createCaller } from "#lib/caller";
import { APIRoute } from "astro";
import { validate } from "uuid";
export const get: APIRoute = async ({params, cookies}) => { import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
const { uid } = params; import { validateAccessTokenServer } from "#server/lib/validateAccessToken.js";
import { prisma } from "@ibcornelsen/database/server";
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
import { fileURLToPath } from "bun";
import * as fs from "fs";
if (!uid) { export const GET = defineApiRoute({
return new Response("No uid provided", { status: 400 }); async fetch(input, context, transfer) {
} const { uid } = context.params
const token = context.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
if (!validate(uid)) { if (!token) {
return new Response("Invalid uid", { status: 400 }); throw new APIError({
} code: "BAD_REQUEST",
message: "Invalid access token"
})
}
const caller = createCaller({ cookies }) const valid = validateAccessTokenServer(context);
const image = await caller.v1.bilder.getBase64({ uid }) if (!valid) {
throw new APIError({
code: "BAD_REQUEST",
message: "Invalid access token"
})
}
if (!image) { const image = await prisma.gebaeudeBilder.findUnique({
return new Response("No image found", { status: 404 }); where: {
} uid
}
})
const buffer = Buffer.from(image.base64, "base64"); if (!image) {
throw new APIError({
code: "NOT_FOUND",
message: "Image could not be found."
})
}
return new Response(buffer, { const path = fileURLToPath(new URL(`../../../../../persistent/images/${image.uid}.webp`, import.meta.url))
headers: { const base64 = fs.readFileSync(path, "base64")
"Content-Type": "image/webp"
} const buffer = Buffer.from(base64, "base64");
});
} return new Response(buffer, {
headers: {
"Content-Type": "image/webp"
}
});
},
})

View File

@@ -0,0 +1,59 @@
---
import { AufnahmeClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
import UserLayout from "#layouts/UserLayout.astro";
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
import DashboardAusweisePruefenModule from "#modules/Dashboard/DashboardAusweisePruefenModule.svelte";
import { prisma } from "@ibcornelsen/database/server";
import { createCaller } from "src/astro-typesafe-api-caller";
const caller = createCaller(Astro)
let user: BenutzerClient;
try {
user = (await caller.user.self.GET.fetch(undefined, {
headers: {
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
}
})) || {} as BenutzerClient;
} catch(e) {
return Astro.redirect("/auth/login")
}
const ausweise = await prisma.verbrauchsausweisWohnen.findMany({
where: {
benutzer: {
uid: user.uid
}
},
include: {
aufnahme: {
include: {
objekt: {
include: {
gebaeude_bilder: true,
}
},
events: true
}
}
}
})
function omit(key: string, obj: Record<string, any>) {
const { [key]: omitted, ...rest } = obj;
return rest;
}
const reformedAusweise = ausweise.map(ausweis => ({
ausweis: omit("aufnahme", ausweis) as VerbrauchsausweisWohnenClient,
aufnahme: omit("objekt", omit("events", ausweis.aufnahme)) as AufnahmeClient,
objekt: omit("gebaeude_bilder", ausweis.aufnahme.objekt) as ObjektClient,
bilder: ausweis.aufnahme.objekt.gebaeude_bilder as unknown as UploadedGebaeudeBild[],
events: ausweis.aufnahme.events
}))
---
<UserLayout title="Ausweise Prüfen" {user}>
<DashboardAusweisePruefenModule ausweise={reformedAusweise} client:load></DashboardAusweisePruefenModule>
</UserLayout>

View File

@@ -25,6 +25,6 @@ const gebaeudeArray = await caller.objekt.GET.fetch({ limit: 5 }, {
}); });
--- ---
<UserLayout title="Dashboard"> <UserLayout title="Dashboard" {user}>
<DashboardModule user={user} gebaeudeArray={gebaeudeArray} /> <DashboardModule user={user} gebaeudeArray={gebaeudeArray} />
</UserLayout> </UserLayout>

View File

@@ -76,5 +76,5 @@ if (uid) {
--- ---
<AusweisLayout title="Verbrauchsausweis erstellen"> <AusweisLayout title="Verbrauchsausweis erstellen">
<VerbrauchsausweisWohnenModule client:load {ausweis} {objekt} {aufnahme} {bilder} /> <VerbrauchsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} />
</AusweisLayout> </AusweisLayout>

View File

@@ -88,6 +88,6 @@ if (!ausweis || !user) {
--- ---
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen"> <AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {ausweisart} selectedPaymentType={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule> <KundendatenModule {user} {ausweis} {objekt} {aufnahme} {ausweisart} bezahlmethode={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule>
</AusweisLayout> </AusweisLayout>

View File

@@ -1,15 +1,16 @@
--- ---
import { prisma } from "@ibcornelsen/database/server"; import { Enums, prisma } from "@ibcornelsen/database/server";
import Layout from "../../layouts/Layout.astro"; import Layout from "../../layouts/Layout.astro";
import { createCaller } from "../../astro-typesafe-api-caller.js"; import { createCaller } from "../../astro-typesafe-api-caller.js";
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants"; import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
import PaymentSuccessModule from "#modules/PaymentSuccessModule.svelte";
const uid = Astro.url.searchParams.get("uid");
const { uid } = Astro.params;
const caller = createCaller(Astro) const caller = createCaller(Astro)
const user = await caller.user.self.GET.fetch(undefined, { const user = await caller.user.self.GET.fetch(undefined, {
headers: { headers: {
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}` Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
@@ -23,7 +24,9 @@ if (!uid || !user) {
const rechnung = await prisma.rechnung.findUnique({ const rechnung = await prisma.rechnung.findUnique({
where: { where: {
uid: uid, uid: uid,
benutzer_id: user.id benutzer: {
uid: user.uid
}
} }
}) })
@@ -33,7 +36,7 @@ if (!rechnung) {
--- ---
<Layout title="Zahlung Erfolgreich - IBCornelsen"> <Layout title="Zahlung Erfolgreich - IBCornelsen">
Supa! Hat geklappt ne! <PaymentSuccessModule {rechnung}></PaymentSuccessModule>
{rechnung.uid}
</Layout> </Layout>