mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-14 10:49:10 +02:00
Fix user creation errors by handling empty emails properly
Adjust user creation schema to allow null emails, update data handling to convert empty strings to null, and provide a SQL script to clean up existing duplicate empty email entries, resolving the `users_email_key` constraint violation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/aiHrulP
This commit is contained in:
1 parent
b886f317ca
commit
c77ea88e9d
5 files changed
+244
-4
No files matched your search
+2
-2
@@ -921,7 +921,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
const createUserSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
username: z.string().min(1, "L'identifiant est obligatoire"),
|
||||
email: z.union([z.string().email(), z.literal("")]).optional(),
|
||||
email: z.union([z.string().email(), z.literal(""), z.null()]).optional(),
|
||||
firstName: z.string().optional(),
|
||||
lastName: z.string().optional(),
|
||||
password: z.string().min(1, "Le mot de passe est obligatoire"),
|
||||
@@ -952,7 +952,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
const userToCreate = {
|
||||
id: newUserId,
|
||||
username: userData.username,
|
||||
email: userData.email || '',
|
||||
email: userData.email && userData.email.trim() !== '' ? userData.email : null, // Use NULL instead of empty string
|
||||
firstName: userData.firstName || '',
|
||||
lastName: userData.lastName || '',
|
||||
password: hashedPassword,
|
||||
|
||||
Reference in new issue
Block a user