Supabase Removals Backend

This commit is contained in:
2026-02-14 12:27:44 +01:00
parent 7dca84947e
commit 6541cb2adf
15 changed files with 415 additions and 343 deletions

View File

@@ -1,5 +1,7 @@
import { FastifyInstance, FastifyRequest } from "fastify";
import fp from "fastify-plugin";
import { eq } from "drizzle-orm";
import { tenants } from "../../db/schema";
export default fp(async (server: FastifyInstance) => {
server.addHook("preHandler", async (req, reply) => {
@@ -9,11 +11,12 @@ export default fp(async (server: FastifyInstance) => {
return;
}
// Tenant aus DB laden
const { data: tenant } = await server.supabase
.from("tenants")
.select("*")
.eq("portalDomain", host)
.single();
const rows = await server.db
.select()
.from(tenants)
.where(eq(tenants.portalDomain, host))
.limit(1);
const tenant = rows[0];
if(!tenant) {
@@ -38,4 +41,4 @@ declare module "fastify" {
settings?: Record<string, any>;
};
}
}
}