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