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
This commit is contained in:
michaelschal committed 2025-08-11 18:04:21 +00:00
1 parent fd92ce25d0
commit 7618fb1643
2 files changed
+19 -10

No files matched your search

+4 -6
View File
@@ -886,23 +886,21 @@ export default function UsersPage() {
<form onSubmit={handleSubmitEdit} className="space-y-4">
<div className="grid grid-cols-2 gap-4">
<div>
<Label htmlFor="edit-firstName">Prénom *</Label>
<Label htmlFor="edit-firstName">Prénom</Label>
<Input
id="edit-firstName"
value={editForm.firstName}
onChange={(e) => setEditForm({...editForm, firstName: e.target.value})}
placeholder="Prénom"
required
placeholder="Prénom (optionnel)"
/>
</div>
<div>
<Label htmlFor="edit-lastName">Nom *</Label>
<Label htmlFor="edit-lastName">Nom</Label>
<Input
id="edit-lastName"
value={editForm.lastName}
onChange={(e) => setEditForm({...editForm, lastName: e.target.value})}
placeholder="Nom"
required
placeholder="Nom (optionnel)"
/>
</div>
</div>
+15 -4
View File
@@ -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
- **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