This commit is contained in:
Frank
2025-10-07 09:17:05 -04:00
parent cd3780b7f5
commit 6c99b833e4
8 changed files with 865 additions and 21 deletions

View File

@@ -174,18 +174,19 @@ export namespace User {
)
})
export const updateRole = fn(
export const update = fn(
z.object({
id: z.string(),
role: z.enum(UserRole),
monthlyLimit: z.number().nullable(),
}),
async ({ id, role }) => {
async ({ id, role, monthlyLimit }) => {
await assertAdmin()
if (role === "member") assertNotSelf(id)
return await Database.use((tx) =>
tx
.update(UserTable)
.set({ role })
.set({ role, monthlyLimit })
.where(and(eq(UserTable.id, id), eq(UserTable.workspaceID, Actor.workspace()))),
)
},