Closed markcdev101 closed 1 week ago
Profiles can have many users of different roles. Username now moved to Users and Email field moved to Profiles as you can only have one email per account but an account can have many usernames that reflect their role.
When an admin user is created, it checks for the email in the Profile table and then when found, it links the Admin with the profile. So a User account who becomes an Admin will be given a separate account for login but will have the same profile.
Added two new custom exceptions
ProfileNotFoundException is when creating an Admin Account and no existing profile is found. The rule is that only existing users with a regular User account and a Profile should be allowed to have a new Admin account. If there is no profile with the same email then it means that there is no user account
DuplicateUsernameException is when trying to create a regular User or an Admin and the username already exists in the User table. Usernames should be unique.
Description: A Profile needs to be created when any user is created. Only existing regular Users can have an admin account - logic is that when creating admin, it checks the Profile table for the existing email and then assign that new Admin account to the profile
Concepts Covered:
Acceptance Criteria:
Guide: