refactor: update user and authentication schema with two-factor support

This commit is contained in:
Mauricio Siu
2025-02-16 15:32:57 -06:00
parent 90156da570
commit e1632cbdb3
33 changed files with 657 additions and 180 deletions

View File

@@ -35,17 +35,22 @@ export const adminRouter = createTRPCRouter({
...rest,
};
}),
update: adminProcedure.mutation(async ({ input, ctx }) => {
if (ctx.user.rol === "member") {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not allowed to update this admin",
});
}
const { id } = await findUserById(ctx.user.id);
// @ts-ignore
return updateAdmin(id, input);
}),
update: adminProcedure
.input(
z.object({
enableDockerCleanup: z.boolean(),
}),
)
.mutation(async ({ input, ctx }) => {
if (ctx.user.rol === "member") {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not allowed to update this admin",
});
}
const user = await findUserById(ctx.user.ownerId);
return updateUser(user.id, {});
}),
createUserInvitation: adminProcedure
.input(apiCreateUserInvitation)
.mutation(async ({ input, ctx }) => {