Fix backend user contract and add User-Employee-Customer linkage

- Add active field to User entity and users table
- Add userId linkage to Employee and Customer entities with unique constraints and FKs
- Add repository methods findByUserId and findAllByEmail
- Create UserBusinessLinkageService for shared employee/customer creation logic
- Create AuthenticationHelper utility for resolving authenticated users
- Update UserService to persist all user fields and create linked business entities
- Update AuthController register to set active and create linked customer
- Update DataInitializer to be idempotent and use shared linkage service
- Update Postman collection user endpoints with fullName, email, and active
This commit is contained in:
2026-03-08 21:56:04 -06:00
parent d86652b462
commit a0d14e493f
12 changed files with 363 additions and 19 deletions

View File

@@ -1435,7 +1435,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"newuser\",\n \"password\": \"password123\",\n \"role\": \"STAFF\"\n}"
"raw": "{\n \"username\": \"newuser\",\n \"password\": \"password123\",\n \"fullName\": \"New User\",\n \"email\": \"newuser@petshop.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}"
}
}
},
@@ -1457,7 +1457,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"user1\",\n \"role\": \"STAFF\"\n}"
"raw": "{\n \"username\": \"user1\",\n \"password\": \"newpassword123\",\n \"fullName\": \"Updated User\",\n \"email\": \"user1@petshop.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}"
}
}
},