Fix Lab 7 feedback: enforce PLAYER role default, proper 404s, admin-only role assignment, expanded TDD#41
Draft
Copilot wants to merge 3 commits into
Draft
Fix Lab 7 feedback: enforce PLAYER role default, proper 404s, admin-only role assignment, expanded TDD#41Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…gnRole endpoint, more TDD tests Agent-Logs-Url: https://github.com/CodeForge-DOSW/TECHCUP-FUTBOL-BackEnd-SpringBoot/sessions/0f3198d8-0a9a-4b05-abe5-821e2cf046c9 Co-authored-by: JuanGuayazanC <162055263+JuanGuayazanC@users.noreply.github.com>
…e role values Agent-Logs-Url: https://github.com/CodeForge-DOSW/TECHCUP-FUTBOL-BackEnd-SpringBoot/sessions/0f3198d8-0a9a-4b05-abe5-821e2cf046c9 Co-authored-by: JuanGuayazanC <162055263+JuanGuayazanC@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Resolve feedback for Lab 7 - Team 2
Fix Lab 7 feedback: enforce PLAYER role default, proper 404s, admin-only role assignment, expanded TDD
Apr 10, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Addresses graded feedback (Lab 7) identifying partial compliance in controller business rules, HTTP status codes, and TDD coverage. The critical finding was missing
@Service(already present in current HEAD); remaining items required actual code changes.Changes
User role enforcement
rolefield toUserEntity(default"PLAYER") andUserRoleModel; updatedUserMapperto map it bidirectionallyUserService.createUsernow explicitly setsrole = "PLAYER"regardless of request payloadAdmin-only role assignment
assignRole(Long targetUserId, String newRole, Long adminUserId)toIUserServiceandUserServicenewRoleagainst allowlist:PLAYER,ADMIN,ORGANIZER,REFEREEadmin.getRole()directly onUserEntity— no entity→model→entity roundtripPUT /api/users/{id}/role?role=X&adminUserId=YinUserControllerProper HTTP status codes
NotFoundExceptionin newexceptionpackageNotFoundExceptionfor all not-found cases; genericRuntimeExceptionremains for validation/business-rule failuresNotFoundException→ 404,RuntimeException→ 400/401Applies to
UserController(updateUser,deactivateUser) and allTournamentControlleroperations.TDD coverage (59 → 80 tests)
authenticate: 6 new tests covering all failure paths (null/blank email, null password, user not found, wrong password, inactive account)createUser: asserts PLAYER role is set by defaultNotFoundExceptionpropagation: covered for all service methods that do lookupsassignRole: admin not found, non-admin caller, target user not found, invalid role value