1 Commits

Author SHA1 Message Date
Moritz Utcke
c0c22453f1 Datenbank 2025-04-29 12:20:21 -03:00
47 changed files with 810 additions and 287 deletions

View File

@@ -61,4 +61,16 @@ jobs:
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
notify_success:
needs: merge
if: success()
runs-on: ubuntu-latest
steps:
- name: Send Discord notification on success
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"✅ Auto-Merge ausgeführt! Ergebnis jetzt auf [GitHub](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) und [online-energieausweis.org](https://online-energieausweis.org) einsehen.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}

View File

@@ -30,7 +30,6 @@ run-database: stop-database
docker volume create $(DB_VOLUME)
docker build -t $(DB_CONTAINER_NAME) .
docker run -d --name $(DB_CONTAINER_NAME) \
--restart=always \
-e POSTGRES_USER=$(DB_USER) \
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
-p $(DB_PORT):5432 \

View File

@@ -2,7 +2,6 @@ version: '3'
services:
database:
build: ./
restart: always
env_file:
- .env
ports:

View File

@@ -0,0 +1,10 @@
-- CreateTable
CREATE TABLE "Log" (
"id" SERIAL NOT NULL,
"level" TEXT NOT NULL,
"message" TEXT NOT NULL,
"meta" JSONB NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Log_pkey" PRIMARY KEY ("id")
);

View File

@@ -0,0 +1,64 @@
-- CreateTable
CREATE TABLE "Attachment" (
"id" TEXT NOT NULL,
"name" TEXT,
"kategorie" TEXT,
"mime" TEXT NOT NULL,
CONSTRAINT "Attachment_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Message" (
"id" TEXT NOT NULL,
"content" TEXT NOT NULL,
"sender_id" TEXT NOT NULL,
"reply_to_id" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_AttachmentToMessage" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_AttachmentToMessage_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateTable
CREATE TABLE "_recipients" (
"A" VARCHAR(11) NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_recipients_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE UNIQUE INDEX "Attachment_id_key" ON "Attachment"("id");
-- CreateIndex
CREATE INDEX "_AttachmentToMessage_B_index" ON "_AttachmentToMessage"("B");
-- CreateIndex
CREATE INDEX "_recipients_B_index" ON "_recipients"("B");
-- AddForeignKey
ALTER TABLE "Message" ADD CONSTRAINT "Message_sender_id_fkey" FOREIGN KEY ("sender_id") REFERENCES "benutzer"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Message" ADD CONSTRAINT "Message_reply_to_id_fkey" FOREIGN KEY ("reply_to_id") REFERENCES "Message"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_AttachmentToMessage" ADD CONSTRAINT "_AttachmentToMessage_A_fkey" FOREIGN KEY ("A") REFERENCES "Attachment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_AttachmentToMessage" ADD CONSTRAINT "_AttachmentToMessage_B_fkey" FOREIGN KEY ("B") REFERENCES "Message"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_recipients" ADD CONSTRAINT "_recipients_A_fkey" FOREIGN KEY ("A") REFERENCES "benutzer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_recipients" ADD CONSTRAINT "_recipients_B_fkey" FOREIGN KEY ("B") REFERENCES "Message"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -0,0 +1,56 @@
/*
Warnings:
- You are about to drop the column `created_at` on the `Message` table. All the data in the column will be lost.
- You are about to drop the column `updated_at` on the `Message` table. All the data in the column will be lost.
- You are about to drop the `_recipients` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `conversation_id` to the `Message` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "_recipients" DROP CONSTRAINT "_recipients_A_fkey";
-- DropForeignKey
ALTER TABLE "_recipients" DROP CONSTRAINT "_recipients_B_fkey";
-- AlterTable
ALTER TABLE "Message" DROP COLUMN "created_at",
DROP COLUMN "updated_at",
ADD COLUMN "conversation_id" TEXT NOT NULL,
ADD COLUMN "sentAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-- DropTable
DROP TABLE "_recipients";
-- CreateTable
CREATE TABLE "Conversation" (
"id" TEXT NOT NULL,
"name" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL
);
-- CreateTable
CREATE TABLE "Participant" (
"id" TEXT NOT NULL,
"benutzer_id" TEXT NOT NULL,
"conversation_id" TEXT NOT NULL,
"joined_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Participant_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Conversation_id_key" ON "Conversation"("id");
-- CreateIndex
CREATE UNIQUE INDEX "Participant_benutzer_id_conversation_id_key" ON "Participant"("benutzer_id", "conversation_id");
-- AddForeignKey
ALTER TABLE "Message" ADD CONSTRAINT "Message_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "Conversation"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Participant" ADD CONSTRAINT "Participant_benutzer_id_fkey" FOREIGN KEY ("benutzer_id") REFERENCES "benutzer"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Participant" ADD CONSTRAINT "Participant_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "Conversation"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,9 @@
model Attachment {
id String @id @unique @default(uuid())
name String?
kategorie String?
mime String
attached_to_messages Message[]
}

View File

@@ -49,7 +49,10 @@ model Benutzer {
BearbeiteteTickets Tickets[] @relation("BearbeiteteTickets")
events Event[]
@@map("benutzer")
conversations Participant[]
messages Message[]
@@map("benutzer")
}

View File

@@ -0,0 +1,9 @@
model Conversation {
id String @unique @default(cuid())
name String?
participants Participant[]
messages Message[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

7
prisma/schema/Log.prisma Normal file
View File

@@ -0,0 +1,7 @@
model Log {
id Int @id @default(autoincrement())
level String
message String
meta Json
timestamp DateTime @default(now())
}

View File

@@ -0,0 +1,17 @@
model Message {
id String @id @default(cuid())
attachments Attachment[]
reply_to_id String? // Nullable because not all messages are replies
reply_to Message? @relation("MessageReplies", fields: [reply_to_id], references: [id])
replies Message[] @relation("MessageReplies")
content String
sender_id String
conversation_id String
sentAt DateTime @default(now())
sender Benutzer @relation(fields: [sender_id], references: [id])
conversation Conversation @relation(fields: [conversation_id], references: [id])
}

View File

@@ -0,0 +1,11 @@
model Participant {
id String @id @default(cuid())
benutzer_id String
conversation_id String
joined_at DateTime @default(now())
benutzer Benutzer @relation(fields: [benutzer_id], references: [id])
conversation Conversation @relation(fields: [conversation_id], references: [id])
@@unique([benutzer_id, conversation_id])
}

View File

@@ -2,6 +2,7 @@ import express from 'express';
import { H, Handlers } from '@highlight-run/node'
// @ts-ignore
import { handler as ssrHandler } from './dist/server/entry.mjs';
import { server } from "./src/ws/server";
const highlightConfig = {
projectID: '1jdkoe52',

View File

@@ -13,33 +13,33 @@ export const createCaller = createCallerFactory({
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
"ausweise": await import("../src/pages/api/ausweise/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"),
"ausweise": await import("../src/pages/api/ausweise/index.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"),
"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"),
"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"),
"ticket": await import("../src/pages/api/ticket/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"),
"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"),
"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"),
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
"objekt/[id]": await import("../src/pages/api/objekt/[id]/index.ts"),
})

View File

@@ -1,5 +1,5 @@
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
import { Aufnahme, Benutzer, Objekt } from "#lib/client/prisma.js";
import { Aufnahme, Objekt } from "#lib/client/prisma.js";
import { api } from "astro-typesafe-api/client";
import Cookies from "js-cookie";
@@ -161,32 +161,4 @@ export async function objektSpeichern(objekt: Objekt & { id?: string }): Promise
return id;
}
}
export async function benutzerSpeichern(benutzer: Partial<Benutzer>): Promise<string> {
const completeBenutzer: Benutzer = {
id: benutzer.id,
name: benutzer.name ?? null,
email: benutzer.email,
passwort: "",
adresse: benutzer.adresse ?? null,
anrede: benutzer.anrede ?? null,
firma: benutzer.firma ?? null,
vorname: benutzer.vorname ?? null,
ort: benutzer.ort ?? null,
plz: benutzer.plz ?? null,
profilbild: benutzer.profilbild ?? null,
telefon: benutzer.telefon ?? null,
updated_at: new Date(),
verified: benutzer.verified ?? false,
};
await api.user.POST.fetch(completeBenutzer
, {
headers: {
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
}
});
return benutzer.id;
}

View File

@@ -327,15 +327,10 @@
</div>
<div class="badge badge-accent font-semibold text-black text-m">
{#if ausweis.ausweistyp === Enums.AusweisTyp.Beratung || ausweis.ausweistyp === Enums.AusweisTyp.BeratungXL}
mit Beratung
mit Beratung
{:else if ausweis.ausweistyp === Enums.AusweisTyp.Offline || ausweis.ausweistyp === Enums.AusweisTyp.OfflineXL}
Offline
Offline
{/if}
{#if (rechnung?.services ?? []).length > 0}
{#if rechnung}
<span class="text-sm italic">({rechnung.services})</span>
{/if}
{/if}
</div>
<div class="mb-4 flex flex-row items-center gap-4">
<div class="w-full border rounded-lg my-2">
@@ -521,17 +516,17 @@
{#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen}
<a
class="button text-sm"
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweis_id={ausweis.id}&typ={AusstellungsTyp.Speichern}"
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweis_id={ausweis.id}"
>Formular</a>
{:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe}
<a
class="button text-sm"
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?ausweis_id={ausweis.id}&typ={AusstellungsTyp.Speichern}"
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?ausweis_id={ausweis.id}"
>Formular</a>
{:else if ausweisart === Enums.Ausweisart.BedarfsausweisWohnen}
<a
class="button text-sm"
href="/energieausweis-erstellen/bedarfsausweis-wohngebaeude?ausweis_id={ausweis.id}&typ={AusstellungsTyp.Speichern}"
href="/energieausweis-erstellen/bedarfsausweis-wohngebaeude?ausweis_id={ausweis.id}"
>Formular</a>
{/if}
{/if}
@@ -688,7 +683,7 @@
{aufnahme.aussenwand_min_12cm_gedaemmt ? "Außenwand min. 12cm gedämmt" : ""}
</div>
<div class="text-xs space-y-1 p-2">
<span class="font-semibold">Hiermit bestätige ich {benutzer.vorname} {benutzer.name} als Besteller:</span><br>
<span class="font-semibold">Hiermit bestätige ich {benutzer.vorname} {benutzer.name} als Besteller folgende Angaben:</span><br>
{#if ausweis.pruefpunkt_heizungsalter}
<div>Das Heizungsalter ist jünger als 3 Jahre. Es betrifft einen Heizungstausch ohne energetische Verbesserung.</div>
{/if}

View File

@@ -0,0 +1,8 @@
import * as z from "zod"
export const AttachmentSchema = z.object({
id: z.string(),
name: z.string().nullish(),
kategorie: z.string().nullish(),
mime: z.string(),
})

View File

@@ -0,0 +1,8 @@
import * as z from "zod"
export const ConversationSchema = z.object({
id: z.string(),
name: z.string().nullish(),
createdAt: z.date(),
updatedAt: z.date(),
})

View File

@@ -1,16 +1,21 @@
export * from "./anteilshaber"
export * from "./apirequests"
export * from "./attachment"
export * from "./aufnahme"
export * from "./bedarfsausweisgewerbe"
export * from "./bedarfsausweiswohnen"
export * from "./benutzer"
export * from "./bild"
export * from "./conversation"
export * from "./event"
export * from "./gegeinpreisung"
export * from "./gegnachweisgewerbe"
export * from "./gegnachweiswohnen"
export * from "./klimafaktoren"
export * from "./log"
export * from "./message"
export * from "./objekt"
export * from "./participant"
export * from "./postleitzahlen"
export * from "./rechnung"
export * from "./refreshtokens"

15
src/generated/zod/log.ts Normal file
View File

@@ -0,0 +1,15 @@
import * as z from "zod"
// Helper schema for JSON fields
type Literal = boolean | number | string
type Json = Literal | { [key: string]: Json } | Json[]
const literalSchema = z.union([z.string(), z.number(), z.boolean()])
const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
export const LogSchema = z.object({
id: z.number().int(),
level: z.string(),
message: z.string(),
meta: jsonSchema,
timestamp: z.date(),
})

View File

@@ -0,0 +1,10 @@
import * as z from "zod"
export const MessageSchema = z.object({
id: z.string(),
reply_to_id: z.string().nullish(),
content: z.string(),
sender_id: z.string(),
conversation_id: z.string(),
sentAt: z.date(),
})

View File

@@ -0,0 +1,8 @@
import * as z from "zod"
export const ParticipantSchema = z.object({
id: z.string(),
benutzer_id: z.string(),
conversation_id: z.string(),
joined_at: z.date(),
})

View File

@@ -102,13 +102,6 @@ const { title } = Astro.props;
<html lang="de">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
<!-- End Google Tag Manager -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
@@ -154,11 +147,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<Header {user} />
<main

View File

@@ -0,0 +1,157 @@
---
import "../style/global.css";
import "../style/formular.css";
import "../../svelte-dialogs.config";
import Header from "#components/design/header/AusweisHeaderImmowelt.astro";
import Footer from "#components/design/footer/Footer.astro";
import { NotificationWrapper } from "@ibcornelsen/ui";
export interface Props {
title: string;
}
const { title } = Astro.props;
---
<script>
window.addEventListener("scroll", (event) => {
let scroll = window.scrollY;
console.log(scroll);
if (scroll >= 400) {
document
.getElementById("skala")
?.classList.add(
"2xl:fixed",
"2xl:py-4",
"2xl:top-0",
"2xl:z-20"
);
document.getElementById("skala")?.classList.remove("w-full");
document.getElementById("skala").style.borderBottom =
"3px solid #e6e6e6";
document.getElementById("performance-box").style.maxWidth =
"688.5px";
document.getElementById("progress-box").style.maxWidth = "688.5px";
document
.getElementById("formInput-1")
?.classList.add("2xl:mt-[370px]");
} else {
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]");
}
});
</script>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
<meta
name="description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<link rel="canonical" href="https://online-energieausweis.org/" />
<meta property="og:locale" content="de_DE" />
<meta property="og:type" content="website" />
<meta
property="og:title"
content="Energieausweis online erstellen - Online Energieausweis"
/>
<meta
property="og:description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<meta property="og:url" content="https://online-energieausweis.org/" />
<meta
property="og:site_name"
content="Energieausweis online erstellen"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<meta
name="twitter:title"
content="Energieausweis online erstellen - Online Energieausweis"
/>
<meta
name="twitter:image"
content="https://online-energieausweis.org/images/energieausweis-online-erstellen.jpg"
/>
<title>
{title || "Energieausweis online erstellen - Online Energieausweis"}
</title>
</head>
<body>
<Header />
<main
class="w-full p-0 grid
xs:grid-cols-[minmax(1fr)] xs:gap-1 xs:p-0
sm:grid-cols-[minmax(1fr)] sm:gap-1 sm:p-0
md:grid-cols-[minmax(1fr)] md:gap-2 md:p-0
lg:grid-cols-[minmax(1fr)] lg:gap-3 lg:p-4
xl:grid-cols-[minmax(1fr)] xl:gap-4 xl:p-6
2xl:grid-cols-[minmax(1fr)] 2xl:gap-5 2xl:p-6"
>
<article class="box rounded-tl-none p-2 lg:p-12">
<slot />
</article>
</main>
<Footer />
<NotificationWrapper client:load />
</body>
</html>
<style is:global lang="postcss">
body {
min-height: 100vh;
width:100%;
}
article {
p, h1, h2, h3, h4, h5, h6 {
@apply text-base-content;
}
}
.headline {
@apply text-lg;
}
.radio-inline {
@apply flex flex-row gap-2;
}
.checkbox-inline {
@apply flex flex-row gap-2;
}
</style>

View File

@@ -0,0 +1,156 @@
---
import "../style/global.css";
import "../style/formular.css";
import "../../svelte-dialogs.config"
import Header from "#components/design/header/AusweisHeaderImmowelt2.astro";
import Footer from "#components/design/footer/Footer.astro";
import { NotificationWrapper } from "@ibcornelsen/ui";
export interface Props {
title: string;
}
const { title } = Astro.props;
---
<script>
window.addEventListener("scroll", (event) => {
let scroll = window.scrollY;
console.log(scroll);
if(scroll>=400){
document.getElementById('skala')?.classList.add('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20');
document.getElementById('skala')?.classList.remove('w-full');
document.getElementById('skala').style.borderBottom = "3px solid #e6e6e6";
document.getElementById('performance-box').style.maxWidth = "688.5px";
document.getElementById('progress-box').style.maxWidth = "688.5px";
document.getElementById('formInput-1')?.classList.add('2xl:mt-[370px]');
}else{
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]');
}
});
</script>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
<meta
name="description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<link rel="canonical" href="https://online-energieausweis.org/" />
<meta property="og:locale" content="de_DE" />
<meta property="og:type" content="website" />
<meta
property="og:title"
content="Energieausweis online erstellen - Online Energieausweis"
/>
<meta
property="og:description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<meta property="og:url" content="https://online-energieausweis.org/" />
<meta property="og:site_name" content="Energieausweis online erstellen" />
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:description"
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
/>
<meta
name="twitter:title"
content="Energieausweis online erstellen - Online Energieausweis"
/>
<meta
name="twitter:image"
content="https://online-energieausweis.org/images/energieausweis-online-erstellen.jpg"
/>
<title>
{title || 'Energieausweis online erstellen - Online Energieausweis'}
</title>
</head>
<body>
<Header />
<main
class="w-full p-0 grid
xs:grid-cols-[minmax(1fr)] xs:gap-1 xs:p-0
sm:grid-cols-[minmax(1fr)] sm:gap-1 sm:p-0
md:grid-cols-[minmax(1fr)] md:gap-2 md:p-0
lg:grid-cols-[minmax(1fr)] lg:gap-3 lg:p-4
xl:grid-cols-[minmax(1fr)] xl:gap-4 xl:p-6
2xl:grid-cols-[minmax(1fr)] 2xl:gap-5 2xl:p-6
">
<article class="box rounded-tl-none p-2 lg:p-12">
<slot />
</article>
</main>
<Footer />
<NotificationWrapper client:load />
</body>
</html>
<style is:global lang="postcss">
body {
min-height: 100vh;
width:100%;
}
article {
p, h1, h2, h3, h4, h5, h6 {
@apply text-base-content;
}
}
.headline {
@apply text-lg;
}
.radio-inline {
@apply flex flex-row gap-2;
}
.checkbox-inline {
@apply flex flex-row gap-2;
}
</style>

View File

@@ -85,14 +85,6 @@ window.addEventListener("scroll", () => {
<!DOCTYPE html>
<html lang="de">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
<!-- End Google Tag Manager -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
@@ -135,11 +127,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<AusweisHeaderPartner {tab}/>
<main class="w-full p-0 grid grid-cols-1 rounded-none">
@@ -148,6 +136,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<article class="p-0 lg:px-20 lg:py-12">
<slot />
<div style="height: 450px;"></div>
</article>
</main>

View File

@@ -37,14 +37,6 @@ const { title } = Astro.props;
<!DOCTYPE html>
<html lang="de">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
<!-- End Google Tag Manager -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
@@ -87,10 +79,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<Header {user} />

View File

@@ -98,15 +98,6 @@ window.addEventListener("scroll", (event) => {
<!DOCTYPE html>
<html lang="de">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
<!-- End Google Tag Manager -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
@@ -120,10 +111,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<Header {user} />

View File

@@ -199,28 +199,19 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
if (bild) {
const file = await getS3File("ibc-images", `${bild.id}.jpg`);
if (file) {
let image: PDFImage;
image = await pdf.embedJpg(file);
const originalWidth = image.width;
const originalHeight = image.height;
// Calculate the scaling factor to fit within the maximum dimensions while maintaining proportions
const scaleFactor = Math.min(111 / originalWidth, 138 / originalHeight);
const scaledWidth = originalWidth * scaleFactor;
const scaledHeight = originalHeight * scaleFactor;
image = await pdf.embedJpg(file)
pages[0].drawImage(image, {
x: 460.5,
y: (height - 289 - scaledHeight) + 138, // Adjust y to align the image properly
width: scaledWidth,
height: scaledHeight
});
y: height - 289,
width: 111,
height: 138
})
}
}
// Checkmark Verbrauchsausweis.
pages[0].drawText("x", {
x: 41,
@@ -369,25 +360,25 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
if (endenergieverbrauchTranslationPercentage > 0.5) {
page.drawText("Endenergieverbrauch Wärme", {
x: endenergieverbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Wärme", 10) - (pfeilWidth / 2),
x: endenergieverbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Wärme", 10),
y: height - 191,
size: 10
})
page.drawText(endEnergieVerbrauchGesamtText, {
x: endenergieverbrauchTranslationX - margin - bold.widthOfTextAtSize(endEnergieVerbrauchGesamtText, 10) - (pfeilWidth / 2),
x: endenergieverbrauchTranslationX - margin - bold.widthOfTextAtSize(endEnergieVerbrauchGesamtText, 10),
y: height - 205,
size: 10,
font: bold
})
} else {
page.drawText("Endenergieverbrauch Wärme", {
x: endenergieverbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: endenergieverbrauchTranslationX + pfeilWidth + margin,
y: height - 191,
size: 10
})
page.drawText(endEnergieVerbrauchGesamtText, {
x: endenergieverbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: endenergieverbrauchTranslationX + pfeilWidth + margin,
y: height - 205,
size: 10,
font: bold
@@ -398,13 +389,13 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
if (vergleichsWertWaermeTranslationPercentage > 0.5) {
page.drawText("Vergleichswert Wärme", {
x: vergleichsWertWaermeTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Wärme", 10) - (pfeilWidth / 2),
x: vergleichsWertWaermeTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Wärme", 10),
y: height - 275,
size: 10
})
page.drawText(vergleichswertWaermeText, {
x: vergleichsWertWaermeTranslationX - margin - bold.widthOfTextAtSize(vergleichswertWaermeText, 10) - (pfeilWidth / 2),
x: vergleichsWertWaermeTranslationX - margin - bold.widthOfTextAtSize(vergleichswertWaermeText, 10),
y: height - 289,
size: 10,
font: bold
@@ -431,7 +422,7 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
})
page.drawImage(pfeilNachOben, {
x: vergleichsWertStromTranslationX,
x: vergleichsWertStromTranslationX,
y: height - 437,
width: pfeilWidth,
height: 30
@@ -441,25 +432,25 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
if (stromVerbrauchTranslationPercentage > 0.5) {
page.drawText("Endenergieverbrauch Strom", {
x: stromVerbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Strom", 10) - (pfeilWidth / 2),
x: stromVerbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Strom", 10),
y: height - 335,
size: 10
})
page.drawText(stromVerbrauchGesamtText, {
x: stromVerbrauchTranslationX - margin - bold.widthOfTextAtSize(stromVerbrauchGesamtText, 10) - (pfeilWidth / 2),
x: stromVerbrauchTranslationX - margin - bold.widthOfTextAtSize(stromVerbrauchGesamtText, 10),
y: height - 349,
size: 10,
font: bold
})
} else {
page.drawText("Endenergieverbrauch Strom", {
x: stromVerbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: stromVerbrauchTranslationX + pfeilWidth + margin,
y: height - 335,
size: 10
})
page.drawText(stromVerbrauchGesamtText, {
x: stromVerbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: stromVerbrauchTranslationX + pfeilWidth + margin,
y: height - 349,
size: 10,
font: bold
@@ -484,12 +475,12 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
})
} else {
page.drawText("Vergleichswert Strom", {
x: vergleichsWertStromTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: vergleichsWertStromTranslationX + pfeilWidth + margin,
y: height - 420,
size: 10
})
page.drawText(vergleichswertStromText, {
x: vergleichsWertStromTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
x: vergleichsWertStromTranslationX + pfeilWidth + margin,
y: height - 434,
size: 10,
font: bold

View File

@@ -59,23 +59,13 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
if (file) {
let image: PDFImage;
image = await pdf.embedJpg(file);
const originalWidth = image.width;
const originalHeight = image.height;
// Calculate the scaling factor to fit within the maximum dimensions while maintaining proportions
const scaleFactor = Math.min(111 / originalWidth, 138 / originalHeight);
const scaledWidth = originalWidth * scaleFactor;
const scaledHeight = originalHeight * scaleFactor;
image = await pdf.embedJpg(file)
pages[0].drawImage(image, {
x: 460.5,
y: (height - 289 - scaledHeight) + 138, // Adjust y to align the image properly
width: scaledWidth,
height: scaledHeight
});
y: height - 289,
width: 111,
height: 138
})
}
}
@@ -343,7 +333,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
}
page.drawImage(pfeilNachUnten, {
x: endenergieverbrauchTranslationX - (pfeilWidth / 2),
x: endenergieverbrauchTranslationX,
y: height - 212,
width: pfeilWidth,
height: 30
@@ -380,7 +370,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
}
page.drawImage(pfeilNachOben, {
x: primaerenergieverbrauchTranslationX - (pfeilWidth / 2),
x: primaerenergieverbrauchTranslationX,
y: height - 297,
width: pfeilWidth,
height: 30
@@ -505,7 +495,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
const addVerbrauch = addVerbrauchGenerator();
if (ausweis.warmwasser_enthalten !== true) {
if (!ausweis.warmwasser_enthalten) {
// Mit Warmwasserzuschlag
addVerbrauch(
moment(ausweis.startdatum).format("MM.YYYY"),
@@ -555,7 +545,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
"Warmwasserzuschlag",
berechnungen?.primaerfaktorww.toString(),
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
"0",
"0"
);

View File

@@ -1,27 +1,9 @@
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
import { checkAuthorizationHeader, checkAuthorizationHeaderNoThrow } from "#lib/middleware/authorization.js";
import { AstroGlobal } from "astro";
import { Enums } from "#lib/client/prisma.js";
import { prisma } from "#lib/server/prisma.js";
export function getCurrentUser(Astro: AstroGlobal) {
const accessToken = Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
return checkAuthorizationHeaderNoThrow(`Bearer ${accessToken}`)
}
export async function getOtherUser(Astro: AstroGlobal, userId : string) {
const accessToken = Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
let currentUser = await checkAuthorizationHeaderNoThrow(`Bearer ${accessToken}`)
if (currentUser?.rolle == Enums.BenutzerRolle.ADMIN) {
const user = await prisma.benutzer.findUnique({
where: {
id: userId
}
})
return user;
}
return null;
}

View File

@@ -57,8 +57,7 @@
"bedarfsausweis-wohnen.ausweis"
);
if (localStorageAusweis) {
ausweis = JSON.parse(localStorageAusweis)
ausweis.ausweistyp = ausweistyp;
ausweis = JSON.parse(localStorageAusweis);
}
const localStorageAufnahme = localStorage.getItem(
@@ -148,7 +147,6 @@
{ausweisart}
{partner_code}
showWeiter={false}
{ausweistyp}
{form}
{skala}
></ButtonWeiterHilfe>
@@ -284,7 +282,6 @@
{ausweisart}
{partner_code}
showWeiter={true}
{ausweistyp}
{form}
{skala}
></ButtonWeiterHilfe>

View File

@@ -0,0 +1,18 @@
<script lang="ts">
const socket = new WebSocket("http://localhost:8080");
socket.on("open", () => {
console.log("Connected to WebSocket");
socket.send("Hello")
})
socket.on("message", (data) => {
console.log(data);
})
</script>
<div>
</div>

View File

@@ -32,11 +32,8 @@
import { getMaximumDevitationInPercent } from "#client/lib/helpers.js";
import { endEnergieVerbrauchVerbrauchsausweis_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016_Client.js";
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016_Client.js";
import { benutzerSpeichern } from "#client/lib/speichern.js";
import { exclude } from "#lib/exclude.js";
export let user: Partial<BenutzerClient>;
export let impersonatedUser: Partial<BenutzerClient> | null = null;
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbe | BedarfsausweisWohnen;
export let aufnahme: AufnahmeClient;
export let objekt: ObjektClient;
@@ -62,10 +59,6 @@
ort = rechnung?.ort || localStorage.getItem("kundendaten.ort") || user.ort || "";
zusatzzeile = rechnung?.zusatzzeile || localStorage.getItem("kundendaten.zusatzzeile") || ""
telefon = rechnung?.telefon || localStorage.getItem("kundendaten.telefon") || user.telefon || "";
} else if (impersonatedUser) {
vorname = impersonatedUser.vorname || "";
name = impersonatedUser.name || "";
telefon = impersonatedUser.telefon || "";
}
let abweichende_versand_adresse = JSON.parse(localStorage.getItem("kundendaten.abweichende_versand_adresse") || "false")
@@ -256,19 +249,6 @@
} else {
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
}
let resultUser: Awaited<ReturnType<typeof benutzerSpeichern>> | Awaited<ReturnType<typeof benutzerSpeichern>> | null = null;
const { passwort, ...baseUser } = impersonatedUser ?? user;
const benutzerObjekt = {
...baseUser,
name,
vorname,
telefon
};
resultUser = await benutzerSpeichern(benutzerObjekt);
} catch(e) {
addNotification({
dismissable: true,
@@ -332,18 +312,6 @@
}
}
let resultUser: Awaited<ReturnType<typeof benutzerSpeichern>> | Awaited<ReturnType<typeof benutzerSpeichern>> | null = null;
const { passwort, ...baseUser } = impersonatedUser ?? user;
const benutzerObjekt = {
...baseUser,
name,
vorname,
telefon
};
resultUser = await benutzerSpeichern(benutzerObjekt);
if (rechnung && rechnung.status === "paid") {
window.location.href = "/dashboard"
return;

View File

@@ -63,7 +63,6 @@
const localStorageAusweis = localStorage.getItem("verbrauchsausweis-gewerbe.ausweis");
if (localStorageAusweis) {
ausweis = JSON.parse(localStorageAusweis)
ausweis.ausweistyp = ausweistyp;
}
const localStorageAufnahme = localStorage.getItem("verbrauchsausweis-gewerbe.aufnahme");
@@ -129,7 +128,6 @@
bind:blockLocalStorageSync
ausweisart={Enums.Ausweisart.VerbrauchsausweisGewerbe}
showWeiter={false}
{ausweistyp}
{form}
{partner_code}
{skala}
@@ -247,7 +245,6 @@
bind:blockLocalStorageSync
ausweisart={Enums.Ausweisart.VerbrauchsausweisGewerbe}
showWeiter={true}
{ausweistyp}
{form}
{partner_code}
{skala}

View File

@@ -329,14 +329,14 @@ export const GET = defineApiRoute({
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
} <b>Bitte beachten Sie unsere neue Bankverbindung.</b> Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
} Nachfolgend finden Sie unsere Bankverbindung. Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
<br>
<table>
<tr><td>Kreditinstitut</td><td>:</td><td>\t Volksbank eG</td>
<tr><td>Kreditinstitut</td><td>:</td><td>\t Commerzbank AG</td>
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
<tr><td>IBAN</td><td>:<td>\t DE13 2519 3331 7209 0731 00</td>
<tr><td>BIC</td><td>:</td><td>\t GENODEF1PAT</td>
<tr><td>IBAN</td><td>:<td>\t DE81 2004 0000 0348 6008 00</td>
<tr><td>BIC</td><td>:</td><td>\t COBADEFFXXX</td>
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
</table>

View File

@@ -197,7 +197,7 @@ export const POST = defineApiRoute({
let filename: string;
if (type === "Ausweis") {
filename = `ID_${ausweis.id}_Energieausweis.pdf`
filename = `ID_${ausweis.id}_Ausweis.pdf`
} else {
filename = `ID_${ausweis.id}_${name}`;
}
@@ -212,7 +212,7 @@ export const POST = defineApiRoute({
const command = new PutObjectCommand({
Bucket: "ibc-pdfs",
Key: filename,
Key: name,
Body: buffer,
ACL: "private",
});
@@ -336,14 +336,14 @@ export const POST = defineApiRoute({
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
} <b>Bitte beachten Sie unsere neue Bankverbindung.</b> Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
} Nachfolgend finden Sie unsere Bankverbindung. Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
<br>
<table>
<tr><td>Kreditinstitut</td><td>:</td><td>\t Volksbank eG</td>
<tr><td>Kreditinstitut</td><td>:</td><td>\t Commerzbank AG</td>
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
<tr><td>IBAN</td><td>:<td>\t DE13 2519 3331 7209 0731 00</td>
<tr><td>BIC</td><td>:</td><td>\t GENODEF1PAT</td>
<tr><td>IBAN</td><td>:<td>\t DE81 2004 0000 0348 6008 00</td>
<tr><td>BIC</td><td>:</td><td>\t COBADEFFXXX</td>
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
</table>

View File

@@ -5,17 +5,18 @@ import { adminMiddleware, authorizationMiddleware } from "#lib/middleware/author
import { hashPassword } from "#lib/password.js";
import { createLexOfficeCustomer } from "#lib/server/lexoffice.js";
import { sendRegisterMail } from "#lib/server/mail/registrierung.js";
import { Benutzer, prisma } from "#lib/server/prisma.js";
import { prisma } from "#lib/server/prisma.js";
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
import { BenutzerSchema } from "src/generated/zod/benutzer.js";
import { z } from "zod";
import { Enums } from "#lib/client/prisma.js";
export const POST = defineApiRoute({
input: BenutzerSchema.omit({
id: true,
lex_office_id: true,
rolle: true,
created_at: true
created_at: true,
updated_at: true
}),
middleware: authorizationMiddleware,
async fetch(input, context, user) {
@@ -23,36 +24,24 @@ export const POST = defineApiRoute({
// TODO: Email wurde geändert, neue Bestätigunsmail schicken.
}
const updateData: any = {};
updateData.id = user.id;
if (input.adresse) updateData.adresse = input.adresse;
if (input.anrede) updateData.anrede = input.anrede;
if (input.email) updateData.email = input.email;
if (input.firma) updateData.firma = input.firma;
if (input.name) updateData.name = input.name;
if (input.vorname) updateData.vorname = input.vorname;
if (input.ort) updateData.ort = input.ort;
if (input.passwort.length != 0) updateData.passwort = hashPassword(input.passwort);
if (input.plz) updateData.plz = input.plz;
if (input.profilbild) updateData.profilbild = input.profilbild;
if (input.telefon) updateData.telefon = input.telefon;
if (input.verified) updateData.telefon = input.verified;
//Admin may update other users
if (user.rolle == Enums.BenutzerRolle.ADMIN && input.id != user.id) {
updateData.id = input.id;
} else if(user.rolle != Enums.BenutzerRolle.ADMIN && input.id != user.id){
return;
}
await prisma.benutzer.update({
where: {
id: updateData.id
id: user.id
},
data: updateData
});
data: {
adresse: input.adresse,
anrede: input.anrede,
email: input.email,
firma: input.firma,
name: input.name,
vorname: input.vorname,
ort: input.ort,
passwort: hashPassword(input.passwort),
plz: input.plz,
profilbild: input.profilbild,
telefon: input.telefon,
}
})
},
})

8
src/pages/chat.astro Normal file
View File

@@ -0,0 +1,8 @@
---
import Layout from "#layouts/Layout.astro";
import ChatModule from "#modules/ChatModule.svelte";
---
<Layout title="Websockets">
<ChatModule client:only></ChatModule>
</Layout>

View File

@@ -50,9 +50,9 @@ if (user.rolle === Enums.BenutzerRolle.USER) {
// SELECT id, updated_at FROM "GEGNachweisGewerbe" WHERE created_at >= ${date} AND bestellt = ${true}
result =
await prisma.$queryRaw`SELECT id, updated_at FROM "VerbrauchsausweisWohnen" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
SELECT id, updated_at FROM "VerbrauchsausweisGewerbe" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
SELECT id, updated_at FROM "BedarfsausweisWohnen" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
await prisma.$queryRaw`SELECT id, updated_at FROM "VerbrauchsausweisWohnen" UNION ALL
SELECT id, updated_at FROM "VerbrauchsausweisGewerbe" UNION ALL
SELECT id, updated_at FROM "BedarfsausweisWohnen" UNION ALL
SELECT id, updated_at FROM "BedarfsausweisGewerbe" UNION ALL
SELECT id, updated_at FROM "GEGNachweisWohnen" UNION ALL
SELECT id, updated_at FROM "GEGNachweisGewerbe"

View File

@@ -3,11 +3,10 @@ import { getAusweisartFromId } from "#components/Ausweis/types";
import AusweisLayoutPruefung from "#layouts/AusweisLayoutPruefung.astro";
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
import { Enums } from "#lib/server/prisma";
import { getCurrentUser, getOtherUser } from "#lib/server/user";
import { getCurrentUser } from "#lib/server/user";
import KundendatenModule from "#modules/KundendatenModule.svelte";
import { PaymentStatus } from "@mollie/api-client";
import { AusweisTyp } from "src/generated/enums";
import { BenutzerClient } from "#components/Ausweis/types.js";
const uid = Astro.url.searchParams.get("uid")
@@ -46,16 +45,8 @@ if (!ausweis) {
if (ausweis.rechnung.status === PaymentStatus.paid) {
return Astro.redirect("/dashboard")
}
let impersonatedUser: Partial<BenutzerClient> | null = null;
if (user){
if (user.id !== ausweis.benutzer_id && ausweis.benutzer_id !== undefined){
impersonatedUser = await getOtherUser(Astro, ausweis.benutzer_id) || {}
}
}
---
<AusweisLayoutPruefung title="Energieausweis Bezahlung">
<KundendatenModule {user} {impersonatedUser} {ausweis} objekt={ausweis.aufnahme.objekt} rechnung={ausweis.rechnung} aufnahme={ausweis.aufnahme} bilder={ausweis.aufnahme.bilder} {ausweisart} ausweistyp={AusweisTyp.Standard} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only></KundendatenModule>
<KundendatenModule {user} {ausweis} objekt={ausweis.aufnahme.objekt} rechnung={ausweis.rechnung} aufnahme={ausweis.aufnahme} bilder={ausweis.aufnahme.bilder} {ausweisart} ausweistyp={AusweisTyp.Standard} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only></KundendatenModule>
</AusweisLayoutPruefung>

View File

@@ -3,10 +3,9 @@
import KundendatenModule from "#modules/KundendatenModule.svelte";
import AusweisLayout from "#layouts/AusweisLayoutPruefung.astro";
import { Enums } from "#lib/client/prisma";
import { getCurrentUser, getOtherUser } from "#lib/server/user";
import { getCurrentUser } from "#lib/server/user";
import { getAusweisartFromId } from "#components/Ausweis/types";
import { getAufnahme, getBedarfsausweisWohnen, getBilder, getObjekt, getRechnung, getUnterlagen, getVerbrauchsausweisGewerbe, getVerbrauchsausweisWohnen } from "#lib/server/db";
import { BenutzerClient } from "#components/Ausweis/types.js";
// Man sollte nur auf diese Seite kommen, wenn ein Ausweis bereits vorliegt und in der Datenbank abgespeichert wurde.
@@ -71,16 +70,9 @@ if (!params.has("ausweis") || !params.has("aufnahme") || !params.has("objekt") |
}
}
let impersonatedUser: Partial<BenutzerClient> | null = null;
if (user){
if (user.id !== ausweis.benutzer_id && ausweis.benutzer_id !== undefined){
impersonatedUser = await getOtherUser(Astro, ausweis.benutzer_id) || {}
}
}
---
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
<KundendatenModule {user} {impersonatedUser} {ausweis} {objekt} {aufnahme} {bilder} {rechnung} {ausweisart} {unterlagen} {partner_code} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only ></KundendatenModule>
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {bilder} {rechnung} {ausweisart} {unterlagen} {partner_code} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only ></KundendatenModule>
</AusweisLayout>

View File

@@ -45,23 +45,14 @@ export const GET: APIRoute = async (Astro) => {
user = await getCurrentUser(Astro)
let pdf: Uint8Array<ArrayBufferLike> | null = null;
if (ausweis.ausgestellt) {
if (/[A-Z]{2}[0-9]{8}/.test(ausweis.id)) {
const id = ausweis.id.match(/[A-Z]{2}([0-9]{8})/) as RegExpMatchArray
// Dieser Ausweis wurde mit der alten Version erstellt, das PDF sollte bereits existieren.
pdf = await getS3File("ibc-pdfs", `ID_${id[1]}_Energieausweis.pdf`)
} else {
pdf = await getS3File("ibc-pdfs", `ID_${ausweis.id}_Energieausweis.pdf`)
}
} else {
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
pdf = await pdfVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
pdf = await pdfVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
} else if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
//todo
}
if (/[A-Z]{2}[0-9]{8}/.test(ausweis.id)) {
const id = ausweis.id.match(/[A-Z]{2}([0-9]{8})/) as RegExpMatchArray
// Dieser Ausweis wurde mit der alten Version erstellt, das PDF sollte bereits existieren.
pdf = await getS3File("ibc-pdfs", `ID_${id[1]}_Energieausweis.pdf`)
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
pdf = await pdfVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
pdf = await pdfVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
}
return new Response(pdf, {

36
src/server/logger.ts Normal file
View File

@@ -0,0 +1,36 @@
import { prisma } from "#lib/server/prisma.js";
import winston from "winston";
import Transport from "winston-transport";
class DatabaseTransport extends Transport {
constructor() {
super();
}
async log(info: any, callback: () => void) {
setImmediate(() => {
this.emit("logged", info);
});
const { level, message, ...meta } = info;
await prisma.log.create({
data: {
level,
message,
meta: JSON.stringify(meta),
},
});
callback();
}
}
export const logger = winston.createLogger({
level: "info",
format: winston.format.json(),
transports: [new DatabaseTransport(), new winston.transports.Console({
handleExceptions: true,
handleRejections: true,
})]
});

30
src/ws/server.ts Normal file
View File

@@ -0,0 +1,30 @@
import { logger } from '#server/logger.js';
import { WebSocketServer } from 'ws';
const server = new WebSocketServer({ port: 8080 });
server.on('connection', (ws, req) => {
logger.info("Client connected to websocket", {
ip: req.socket.remoteAddress
})
ws.on('message', (message) => {
logger.info("Received websocket message", {
message
});
ws.send(`Server received: ${message}`);
});
ws.on('close', () => {
logger.info('Client disconnected', {
ip: req.socket.remoteAddress
});
});
});
logger.info(`Websocket server listening on port ${8080}`)
export { server };

60
src/ws/types.ts Normal file
View File

@@ -0,0 +1,60 @@
import { Conversation, Message } from "#lib/client/prisma.js";
export type WebsocketClientToServerMessage =
| {
type: "messages/get";
payload: {
conversation_id: string;
filters?: {
after?: Date;
before?: Date;
};
};
}
| {
type: "message/send";
payload: {
conversation_id: string;
content: string;
reply_to_id?: string;
};
}
| {
type: "conversations/get";
payload: {
includeMessages?: boolean;
};
}
| {
type: "conversation/create";
payload: {
participant_ids: string[]; // includes sender
name?: string; // optional for group
};
};
/* ---------------------------- Server to client ---------------------------- */
export type WebsocketServerToClientMessage =
| {
type: "messages/list";
payload: {
conversation_id: string;
messages: Message[];
};
}
| {
type: "message/new";
payload: Message;
}
| {
type: "conversations/list";
payload: Conversation[];
}
| {
type: "error";
payload: {
code: string;
message: string;
};
};