Added Cors Hosts

This commit is contained in:
2025-09-13 18:10:43 +02:00
parent 91a62f88d2
commit 717eaf0851
2 changed files with 43 additions and 2 deletions

View File

@@ -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,
}
})
}