From 1fd568c562c06bb7dffee44521883f3e1483e994 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 5 Oct 2025 15:00:21 +0200 Subject: [PATCH] Tidying --- src/plugins/tenant.ts | 3 --- src/routes/auth/auth.ts | 12 ++---------- src/routes/auth/me.ts | 1 - src/routes/files.ts | 17 ----------------- src/routes/resources.ts | 4 ---- 5 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/plugins/tenant.ts b/src/plugins/tenant.ts index d77fab2..0556b36 100644 --- a/src/plugins/tenant.ts +++ b/src/plugins/tenant.ts @@ -8,9 +8,6 @@ export default fp(async (server: FastifyInstance) => { reply.code(400).send({ error: "Missing host header" }); return; } - - console.log(host) - // Tenant aus DB laden const { data: tenant } = await server.supabase .from("tenants") diff --git a/src/routes/auth/auth.ts b/src/routes/auth/auth.ts index 86cf6d6..72e3199 100644 --- a/src/routes/auth/auth.ts +++ b/src/routes/auth/auth.ts @@ -101,12 +101,8 @@ export default async function authRoutes(server: FastifyInstance) { .select("*, tenants!auth_tenant_users(*)") .eq("email", body.email) - console.log(data) - console.log(error) - // @ts-ignore user = (data || []).find(i => i.tenants.find(x => x.id === req.tenant.id)) - console.log(user) if(error) { // @ts-ignore return reply.code(500).send({ error: "Internal Server Error" }); @@ -120,7 +116,6 @@ export default async function authRoutes(server: FastifyInstance) { .single(); user = data if(error) { - console.log(error); // @ts-ignore return reply.code(500).send({ error: "Internal Server Error" }); } @@ -131,18 +126,15 @@ export default async function authRoutes(server: FastifyInstance) { return reply.code(401).send({ error: "Invalid credentials" }); } else { - console.log(user); - console.log(body) - const valid = await bcrypt.compare(body.password, user.password_hash); if (!valid) { // @ts-ignore return reply.code(401).send({ error: "Invalid credentials" }); } else { const token = jwt.sign( - { user_id: user.id, email: user.email, tenant_id: req.tenant ? req.tenant.id : null }, + { user_id: user.id, email: user.email, tenant_id: req.tenant?.id ? req.tenant.id : null }, secrets.JWT_SECRET!, - { expiresIn: "3h" } + { expiresIn: "6h" } ); reply.setCookie("token", token, { diff --git a/src/routes/auth/me.ts b/src/routes/auth/me.ts index 510ea89..ed528c3 100644 --- a/src/routes/auth/me.ts +++ b/src/routes/auth/me.ts @@ -64,7 +64,6 @@ export default async function meRoutes(server: FastifyInstance) { if(permissionsError) { console.log(permissionsError) } - console.log(permissionsData) const permissions = permissionsData.map(i => i.permission) || [] diff --git a/src/routes/files.ts b/src/routes/files.ts index c18529c..886fd2d 100644 --- a/src/routes/files.ts +++ b/src/routes/files.ts @@ -22,23 +22,6 @@ export default async function fileRoutes(server: FastifyInstance) { console.log(data) - /*const parts = req.parts() // mehrere FormData-Felder - - console.log(parts) - - let file: any - let meta: any - - for await (const part of parts) { - //console.log(part) - // @ts-ignore - if (part.file) { - file = part - - // @ts-ignore - meta = JSON.parse(part.fields?.meta?.value) - } - }*/ let meta = JSON.parse(data.fields?.meta?.value) diff --git a/src/routes/resources.ts b/src/routes/resources.ts index 5b5dad8..5bba9b3 100644 --- a/src/routes/resources.ts +++ b/src/routes/resources.ts @@ -543,10 +543,6 @@ export default async function resourceRoutes(server: FastifyInstance) { createData[dataType.numberRangeHolder] = result.usedNumber } - - - - const { data, error } = await server.supabase .from(resource) .insert(createData)