From 7618fb164320afdc854b3f302c93931cd22b905a Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 11 Aug 2025 18:04:21 +0000 Subject: [PATCH] Make user name fields optional in all interfaces Updated user management forms to make first and last name fields optional, aligning with production server requirements and fixing inconsistencies between user creation and editing. 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/vetH0Gp --- client/src/pages/Users.tsx | 10 ++++------ replit.md | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/client/src/pages/Users.tsx b/client/src/pages/Users.tsx index 7b7eddc..a9f48e8 100644 --- a/client/src/pages/Users.tsx +++ b/client/src/pages/Users.tsx @@ -886,23 +886,21 @@ export default function UsersPage() {
- + setEditForm({...editForm, firstName: e.target.value})} - placeholder="Prénom" - required + placeholder="Prénom (optionnel)" />
- + setEditForm({...editForm, lastName: e.target.value})} - placeholder="Nom" - required + placeholder="Nom (optionnel)" />
diff --git a/replit.md b/replit.md index fc0f037..4ade16d 100644 --- a/replit.md +++ b/replit.md @@ -79,14 +79,25 @@ Preferred communication style: Simple, everyday language. ## Recent Changes -### August 11, 2025 - User Deletion Fix +### August 11, 2025 - User Management Improvements + +#### User Deletion Fix - **Issue**: Foreign key constraint errors when deleting users who created customer orders or other records - **Root Cause**: User records were referenced by multiple tables (customer_orders, deliveries, DLC products, etc.) - **Solution Implemented**: - Enhanced deleteUser method with database transaction for atomicity - Prioritized lookup for `admin_local` (default admin) with fallback to any admin user - Ownership transfer of all user-created records to existing admin before deletion - - Comprehensive handling of all foreign key relationships + - Comprehensive handling of all foreign key relationships including role assignments - Graceful error handling when no admin user exists -- **Tables Handled**: customer_orders, orders, deliveries, publicities, dlcProducts, tasks, nocodbConfig, userGroups, userRoles -- **Result**: Safe user deletion while preserving business data integrity \ No newline at end of file +- **Tables Handled**: customer_orders, orders, deliveries, publicities, dlcProducts, tasks, nocodbConfig, userGroups, userRoles (both userId and assignedBy) +- **Result**: Safe user deletion while preserving business data integrity + +#### User Name Fields Optional in Production +- **Issue**: Inconsistent validation between user creation and editing forms for name fields +- **Root Cause**: Edit form required firstName/lastName while creation form had them as optional +- **Solution Implemented**: + - Removed required validation from edit form firstName/lastName fields + - Updated placeholders to indicate "(optionnel)" for consistency + - Maintained database schema where name fields are already optional +- **Result**: Name fields now consistently optional across all user management interfaces \ No newline at end of file