Working times and tenant profiles

This commit is contained in:
2025-10-13 21:33:28 +02:00
parent ef0af906ff
commit e0ed8f41bb
2 changed files with 216 additions and 4 deletions

View File

@@ -98,6 +98,28 @@ export default async function routes(server: FastifyInstance) {
return { tenant_id, users: correctedData };
});
server.get("/tenant/profiles", async (req, reply) => {
const { tenant_id } = req.params as { tenant_id: string };
const authUser = req.user // kommt aus JWT (user_id + tenant_id)
if (!authUser) {
return reply.code(401).send({ error: "Unauthorized" })
}
const { data, error } = await server.supabase
.from("auth_profiles")
.select()
.eq("tenant_id", authUser.tenant_id);
if (error) {
console.log(error);
return reply.code(400).send({ error: error.message });
}
return { data };
});
server.put("/tenant/numberrange/:numberrange", async (req, reply) => {
if (!req.user) {
return reply.code(401).send({ error: "Unauthorized" });