From 717eaf0851ce11d750b6a37a3f8d7f1274b1dddc Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sat, 13 Sep 2025 18:10:43 +0200 Subject: [PATCH] Added Cors Hosts --- src/routes/auth/user.ts | 41 +++++++++++++++++++++++++++++++++++++++++ src/utils/pdf.ts | 4 ++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/routes/auth/user.ts b/src/routes/auth/user.ts index 78ac0e6..7239922 100644 --- a/src/routes/auth/user.ts +++ b/src/routes/auth/user.ts @@ -64,4 +64,45 @@ export default async function userRoutes(server: FastifyInstance) { profile, } }) + + server.put("/user/:id/profile", async (req, reply) => { + + const { id } = req.params as { id?: string } + + const { data } = req.body as { data?: object } + + // 4. Profil für den aktiven Tenant laden + let profile = null + if (req.user.tenant_id) { + const { data: profileData } = await server.supabase + .from("auth_profiles") + .select("*") + .eq("user_id", req.user.user_id) + .eq("tenant_id", req.user.tenant_id) + .single() + + profile = profileData + } + + console.log(data) + + //Update Profile + const { data: updatedProfileData, error: updateError } = await server.supabase + .from("auth_profiles") + .update(data) + .eq("user_id", id) + .eq("id", profile?.id) + .select("*") + .single() + + console.log(updateError) + console.log(updatedProfileData) + + // 5. Permissions laden (über Funktion) + + // 6. Response zurückgeben + return { + data, + } + }) } \ No newline at end of file diff --git a/src/utils/pdf.ts b/src/utils/pdf.ts index 6e1681a..904bbbe 100644 --- a/src/utils/pdf.ts +++ b/src/utils/pdf.ts @@ -805,7 +805,7 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi }) } else if (invoiceData.taxType === "19 UStG") { pages[pageCounter - 1].drawText("Als Kleinunternehmer im Sinne von § 19 Abs. 1 UStG wird keine Umsatzsteuer berechnet.", { - ...getCoordinatesForPDFLib(20, rowHeight + invoiceData.totalArray.length * 8, page1), + ...getCoordinatesForPDFLib(21, rowHeight + invoiceData.totalArray.length * 8, page1), size: 10, color: rgb(0, 0, 0), lineHeight: 10, @@ -814,7 +814,7 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi }) } else if (invoiceData.taxType === "12.3 UStG") { pages[pageCounter - 1].drawText("Umsatzsteuer befreite Lieferung/Leistung für PV-Anlagen gemäß § 12 Absatz 3 UStG.", { - ...getCoordinatesForPDFLib(20, rowHeight + invoiceData.totalArray.length * 8, page1), + ...getCoordinatesForPDFLib(21, rowHeight + invoiceData.totalArray.length * 8, page1), size: 10, color: rgb(0, 0, 0), lineHeight: 10,