feat: add organizations and members

This commit is contained in:
Mauricio Siu
2025-02-17 02:48:42 -06:00
parent c7d47a6003
commit b73e4102dd
17 changed files with 5385 additions and 329 deletions

View File

@@ -9,7 +9,7 @@ import {
import {
IS_CLOUD,
createInvitation,
findUserByAuthId,
findOrganizationById,
findUserById,
getUserByToken,
removeUserById,
@@ -98,21 +98,20 @@ export const adminRouter = createTRPCRouter({
try {
const user = await findUserById(input.id);
if (user.id !== ctx.user.ownerId) {
const organization = await findOrganizationById(
ctx.session?.activeOrganizationId || "",
);
if (organization?.ownerId !== ctx.user.ownerId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not allowed to assign permissions",
});
}
await updateUser(user.id, {
...input,
});
// await db
// .update(users)
// .set({
// ...input,
// })
// .where(eq(users.userId, input.userId));
} catch (error) {
throw error;
}