Working times and tenant profiles
This commit is contained in:
@@ -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" });
|
||||
|
||||
Reference in New Issue
Block a user