A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
feat: add username validation to prevent duplicate
Thomas Camlong781247de5141
diff --git a/packages/api/src/router/user.ts b/packages/api/src/router/user.tsindex e57fd2fa3..f548a7f15 100644--- a/packages/api/src/router/user.ts+++ b/packages/api/src/router/user.ts@@ -32,6 +32,16 @@ export const userRouter = createTRPCRouter({create: publicProcedure.input(validation.user.create).mutation(async ({ ctx, input }) => {+ const user = await ctx.db.query.users.findFirst({+ where: eq(users.name, input.username),+ });++ if (user !== null) {+ throw new TRPCError({+ code: "FORBIDDEN",+ message: "User already exists",+ });+ }await createUser(ctx.db, input);}),getAll: publicProcedure.query(async ({ ctx }) => {