ID statt UID
This commit is contained in:
@@ -137,7 +137,7 @@ export function getAusweisartFromUUID(id: string): Enums.Ausweisart | null {
|
||||
}
|
||||
|
||||
export type UnterlageClient = Omit<Unterlage, "id" | "aufnahme_id">
|
||||
export type BildClient = Omit<Bild, "id" | "aufnahme_id" | "name">
|
||||
export type BildClient = Omit<Bild, "aufnahme_id" | "name">
|
||||
|
||||
export type ObjektKomplettClient = ObjektClient & {
|
||||
aufnahmen: AufnahmeKomplettClient[]
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import { Enums, Objekt } from "#lib/client/prisma.js";
|
||||
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016 } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016.js";
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
import { addNotification } from "#components/Notifications/shared.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
||||
@@ -25,9 +24,9 @@
|
||||
export let benutzer: BenutzerClient;
|
||||
const progress = ausweis.ausgestellt ? 100 : ausweis.bestellt ? 66 : 33;
|
||||
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.id);
|
||||
|
||||
const id = ausweis.alte_ausweis_id || shortenUID(ausweis.uid);
|
||||
const id = ausweis.alte_ausweis_id || ausweis.id;
|
||||
|
||||
async function ausweisStornieren() {
|
||||
const result = await dialogs.confirm({
|
||||
@@ -46,18 +45,18 @@
|
||||
|
||||
if (result === true) {
|
||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||
await api["verbrauchsausweis-wohnen"]._uid.DELETE.fetch(undefined, {
|
||||
await api["verbrauchsausweis-wohnen"]._id.DELETE.fetch(undefined, {
|
||||
params: {
|
||||
uid: ausweis.uid,
|
||||
id: ausweis.id,
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
},
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||
await api["verbrauchsausweis-gewerbe"]._uid.DELETE.fetch(undefined, {
|
||||
await api["verbrauchsausweis-gewerbe"]._id.DELETE.fetch(undefined, {
|
||||
params: {
|
||||
uid: ausweis.uid,
|
||||
id: ausweis.id,
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
@@ -95,7 +94,7 @@
|
||||
async function registriernummerAnfordern() {
|
||||
try {
|
||||
const result = await api.admin.registriernummer.GET.fetch({
|
||||
uid: ausweis.uid
|
||||
uid: ausweis.id
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
@@ -115,7 +114,7 @@
|
||||
async function stornieren() {
|
||||
try {
|
||||
const response = await api.admin.stornieren.PUT.fetch({
|
||||
uid_ausweis: ausweis.uid
|
||||
uid_ausweis: ausweis.id
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
@@ -145,7 +144,7 @@
|
||||
async function ausweisAusstellen() {
|
||||
try {
|
||||
await api.admin.ausstellen.GET.fetch({
|
||||
uid_ausweis: ausweis.uid
|
||||
uid_ausweis: ausweis.id
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
@@ -297,13 +296,13 @@
|
||||
<!--
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.id}"
|
||||
>Stornieren</a>
|
||||
-->
|
||||
{/if}
|
||||
|
||||
{#if ausweis.bestellt && (!rechnung || rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung)}
|
||||
<!-- <a href="/energieausweis-erstellen/bezahlung?uid={ausweis.uid}" class="button text-sm">Bezahlen</a> -->
|
||||
<!-- <a href="/energieausweis-erstellen/bezahlung?uid={ausweis.id}" class="button text-sm">Bezahlen</a> -->
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -312,12 +311,12 @@
|
||||
{#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.id}"
|
||||
>Bearbeiten</a>
|
||||
{:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid={ausweis.uid}"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid={ausweis.id}"
|
||||
>Bearbeiten</a>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -327,12 +326,12 @@
|
||||
{#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.id}"
|
||||
>Formular</a>
|
||||
{:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid={ausweis.uid}"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid={ausweis.id}"
|
||||
>Formular</a>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -347,7 +346,7 @@
|
||||
class="p-2 rounded-lg hover:bg-gray-200"
|
||||
title="PDF Herunterladen"
|
||||
target="_blank"
|
||||
href="/pdf/ansichtsausweis?uid={ausweis.uid}"
|
||||
href="/pdf/ansichtsausweis?uid={ausweis.id}"
|
||||
>
|
||||
<img src="/images/ausweis.webp" width="32" alt="Energieausweis">
|
||||
</a>
|
||||
@@ -355,7 +354,7 @@
|
||||
class="p-2 rounded-lg hover:bg-gray-200"
|
||||
title="PDF Herunterladen"
|
||||
target="_blank"
|
||||
href="/pdf/datenblatt?uid={ausweis.uid}"
|
||||
href="/pdf/datenblatt?uid={ausweis.id}"
|
||||
>
|
||||
<img src="/images/datenblatt.webp" width="32" alt="Datenblatt">
|
||||
</a>
|
||||
|
||||
@@ -20,6 +20,7 @@ const { title } = Astro.props;
|
||||
<script>
|
||||
import { H } from "highlight.run";
|
||||
|
||||
if (import.meta.env.PROD) {
|
||||
H.init("1jdkoe52", {
|
||||
serviceName: "online-energieausweis",
|
||||
backendUrl: "https://highlight-backend.ibcornelsen.de/public",
|
||||
@@ -29,6 +30,7 @@ const { title } = Astro.props;
|
||||
recordHeadersAndBody: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", (event) => {
|
||||
const skala = document.getElementById("skala");
|
||||
|
||||
@@ -20,7 +20,8 @@ const { title } = Astro.props;
|
||||
<script>
|
||||
import { H } from "highlight.run";
|
||||
|
||||
H.init("1jdkoe52", {
|
||||
if (import.meta.env.PROD) {
|
||||
H.init("1jdkoe52", {
|
||||
serviceName: "online-energieausweis",
|
||||
backendUrl: "https://highlight-backend.ibcornelsen.de/public",
|
||||
tracingOrigins: true,
|
||||
@@ -28,7 +29,8 @@ H.init("1jdkoe52", {
|
||||
enabled: true,
|
||||
recordHeadersAndBody: true
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ const schema = JSON.stringify({
|
||||
<script>
|
||||
import { H } from "highlight.run";
|
||||
|
||||
H.init("1jdkoe52", {
|
||||
if (import.meta.env.PROD) {
|
||||
H.init("1jdkoe52", {
|
||||
serviceName: "online-energieausweis",
|
||||
backendUrl: "https://highlight-backend.ibcornelsen.de/public",
|
||||
tracingOrigins: true,
|
||||
@@ -45,7 +46,8 @@ H.init("1jdkoe52", {
|
||||
enabled: true,
|
||||
recordHeadersAndBody: true
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -74,7 +74,8 @@ let lightTheme = Astro.cookies.get("theme")?.value === "light";
|
||||
<script>
|
||||
import { H } from "highlight.run";
|
||||
|
||||
H.init("1jdkoe52", {
|
||||
if (import.meta.env.PROD) {
|
||||
H.init("1jdkoe52", {
|
||||
serviceName: "online-energieausweis",
|
||||
backendUrl: "https://highlight-backend.ibcornelsen.de/public",
|
||||
tracingOrigins: true,
|
||||
@@ -82,7 +83,8 @@ H.init("1jdkoe52", {
|
||||
enabled: true,
|
||||
recordHeadersAndBody: true
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -21,7 +21,8 @@ const { title } = Astro.props;
|
||||
<script>
|
||||
import { H } from "highlight.run";
|
||||
|
||||
H.init("1jdkoe52", {
|
||||
if (import.meta.env.PROD) {
|
||||
H.init("1jdkoe52", {
|
||||
serviceName: "online-energieausweis",
|
||||
backendUrl: "https://highlight-backend.ibcornelsen.de/public",
|
||||
tracingOrigins: true,
|
||||
@@ -29,7 +30,8 @@ H.init("1jdkoe52", {
|
||||
enabled: true,
|
||||
recordHeadersAndBody: true
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
window.addEventListener("scroll", (event) => {
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import { AufnahmeClient, BenutzerClient, BildClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { AufnahmeClient, BenutzerClient, BildClient, ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
|
||||
import * as fs from "fs"
|
||||
import { PDFDocument, rgb, StandardFonts, TextAlignment } from "pdf-lib";
|
||||
import { checkbox, flex, text } from "./elements/index.js";
|
||||
import { PDFDocument, StandardFonts } from "pdf-lib";
|
||||
import { xml2pdf } from "./elements/xml2pdf.js";
|
||||
import moment from "moment";
|
||||
import { BilderKategorie, Enums, Heizungsstatus } from "#lib/server/prisma.js";
|
||||
import { fileURLToPath } from "url";
|
||||
import { Enums, Heizungsstatus } from "#lib/server/prisma.js";
|
||||
import { copyPage } from "./utils/copyPage.js";
|
||||
import { PERSISTENT_DIR } from "#lib/server/constants.js";
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
|
||||
/* -------------------------------- Pdf Tools ------------------------------- */
|
||||
|
||||
@@ -53,7 +49,7 @@ export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: Verbrauchsau
|
||||
|
||||
const innerWidth = pages[0].getWidth() - marginX * 2;
|
||||
|
||||
const id = shortenUID(ausweis.uid);
|
||||
const id = ausweis.id;
|
||||
|
||||
const layout = xml2pdf(`<layout height="${pages[0].getHeight()}" width="${pages[0].getWidth()}" marginTop="150" marginLeft="${marginX}" marginRight="${marginX}">
|
||||
<text size="12" lineHeight="14">${benutzer.vorname} ${benutzer.name}</text>
|
||||
@@ -309,8 +305,8 @@ export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: Verbrauchsau
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bild.uid) {
|
||||
image = `<img src="${bild.uid}.jpg" width="${(pages[2].getWidth() - 120) / 3.1}" height="${(pages[2].getHeight() - marginY * 2) / 4}" />`
|
||||
if (bild.id) {
|
||||
image = `<img src="${bild.id}.jpg" width="${(pages[2].getWidth() - 120) / 3.1}" height="${(pages[2].getHeight() - marginY * 2) / 4}" />`
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
import { BedarfsausweisWohnen, Enums, Rechnung, VerbrauchsausweisGewerbe, VerbrauchsausweisWohnen } from "../prisma.js";
|
||||
|
||||
export function getPaymentSuccessSubject(ausweis: VerbrauchsausweisWohnen | VerbrauchsausweisGewerbe | BedarfsausweisWohnen, rechnung: Rechnung, ausweisart: Enums.Ausweisart) {
|
||||
const id = shortenUID(ausweis.uid);
|
||||
const id = ausweis.id;
|
||||
|
||||
let subject: string = "";
|
||||
|
||||
@@ -33,7 +32,7 @@ export function getPaymentSuccessSubject(ausweis: VerbrauchsausweisWohnen | Verb
|
||||
}
|
||||
|
||||
export function getPaymentInvoiceBody(ausweis: VerbrauchsausweisWohnen | VerbrauchsausweisGewerbe | BedarfsausweisWohnen, rechnung: Rechnung, ausweisart: Enums.Ausweisart) {
|
||||
const id = shortenUID(ausweis.uid);
|
||||
const id = ausweis.id;
|
||||
|
||||
let body: string = "";
|
||||
|
||||
@@ -262,7 +261,7 @@ export function getPaymentInvoiceBody(ausweis: VerbrauchsausweisWohnen | Verbrau
|
||||
}
|
||||
|
||||
export function getPaymentSuccessBody(ausweis: VerbrauchsausweisWohnen | VerbrauchsausweisGewerbe | BedarfsausweisWohnen, rechnung: Rechnung, ausweisart: Enums.Ausweisart) {
|
||||
const id = shortenUID(ausweis.uid);
|
||||
const id = ausweis.id;
|
||||
|
||||
let body: string = "";
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
import { prisma } from "#lib/server/prisma.js";
|
||||
import { getAnsichtsausweis } from "../ausweis.js";
|
||||
import Mail from "nodemailer/lib/mailer/index.js";
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
import { getPaymentSuccessSubject } from "./helpers.js";
|
||||
import { getPaymentInvoiceBody } from "./helpers.js";
|
||||
|
||||
@@ -33,7 +32,7 @@ export async function sendInvoiceMail(
|
||||
return;
|
||||
}
|
||||
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.id);
|
||||
|
||||
if (!ausweisart) {
|
||||
return
|
||||
@@ -41,8 +40,7 @@ export async function sendInvoiceMail(
|
||||
|
||||
const attachments: Mail.Attachment[] = [];
|
||||
|
||||
const id = shortenUID(ausweis.uid)
|
||||
|
||||
const id = ausweis.id;
|
||||
|
||||
if (ausweisart != Enums.Ausweisart.BedarfsausweisWohnen && ausweis.ausweistyp === Enums.AusweisTyp.Standard) {
|
||||
const ansichtsausweis = await getAnsichtsausweis(
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
import { prisma } from "#lib/server/prisma.js";
|
||||
import { getAnsichtsausweis } from "../ausweis.js";
|
||||
import Mail from "nodemailer/lib/mailer/index.js";
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
import { getPaymentSuccessSubject } from "./helpers.js";
|
||||
import { getPaymentSuccessBody } from "./helpers.js";
|
||||
|
||||
@@ -33,7 +32,7 @@ export async function sendPaymentSuccessMail(
|
||||
}
|
||||
|
||||
let info: string = "";
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.id);
|
||||
|
||||
if (!ausweisart) {
|
||||
return;
|
||||
@@ -41,7 +40,7 @@ export async function sendPaymentSuccessMail(
|
||||
|
||||
const attachments: Mail.Attachment[] = [];
|
||||
|
||||
const id = shortenUID(ausweis.uid)
|
||||
const id = ausweis.id
|
||||
|
||||
if (ausweisart != Enums.Ausweisart.BedarfsausweisWohnen && ausweis.ausweistyp === Enums.AusweisTyp.Standard) {
|
||||
const ansichtsausweis = await getAnsichtsausweis(
|
||||
|
||||
@@ -4,7 +4,6 @@ import { BASE_URI } from "#lib/constants";
|
||||
import { transport } from "#lib/mail";
|
||||
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
|
||||
import { getCurrentUser } from "#lib/server/user";
|
||||
import { shortenUID } from "#server/lib/hash.js";
|
||||
|
||||
const user = await getCurrentUser(Astro)
|
||||
const uid = Astro.url.searchParams.get("uid");
|
||||
@@ -23,7 +22,7 @@ const ausweis = await adapter.findUnique({
|
||||
}
|
||||
})
|
||||
|
||||
const id = shortenUID(ausweis.uid);
|
||||
const id = ausweis.id;
|
||||
|
||||
if (!ausweis) {
|
||||
return Astro.redirect("/")
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
/**
|
||||
* Kürzt eine UUID auf 6 Zeichen indem es die ersten 6 Zeichen dieser UUID benutzt.
|
||||
* @param uid Die UID
|
||||
* @returns Eine gekürzte Version der UID
|
||||
*/
|
||||
export function shortenUID(uid: string) {
|
||||
return uid.split("-")[1].slice(0, 6).toUpperCase();
|
||||
}
|
||||
Reference in New Issue
Block a user