signUp: publicProcedure.input(SignUpSchema).mutation(async ({ input }) => { const passwordHash = hashSync(input.password, 10); const isEmailTaken = await userModel.exists({ email: input.email }); if (isEmailTaken) { console.log("Email is already taken"); throw new TRPCError({ code: "BAD_REQUEST", message: "Email is already taken", }); } await userModel.insertMany([ { email: input.email, password: passwordHash, firstName: input.firstName, lastName: input.lastName, }, ]); return { signedUp: true }; }),