feat: add nickname column to players table #414
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/basketball-api!414
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "408-player-nickname"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a nullable
nicknamefield (String(100)) to the Player model so admins can assign display nicknames to players. The field is admin-set only — non-admin PATCH requests silently ignore it.Changes
src/basketball_api/models.py— Addednickname: Mapped[str | None]column (String(100), nullable)alembic/versions/031_add_nickname_to_players.py— Migration to add the columnsrc/basketball_api/routes/players.py— Added nickname toPlayerProfileResponse,PlayerProfileUpdate, and_player_profile_responsehelper. Added admin-only guard that strips nickname from non-admin PATCH requests.src/basketball_api/routes/admin.py— Added nickname toAdminPlayerItemschema and serialization in admin players listtests/test_nickname.py— 9 tests covering model behavior, API round-trip (admin set/clear/persist), non-admin rejection, and admin list inclusionTest Plan
pytest tests/test_nickname.py— 9/9 passpytest tests/— 907 passed, 8 errors (pre-existing enum collision in test_account.py, unrelated)ruff format+ruff check— cleanReview Checklist
Related Notes
None.
Related
QA Review — PR #414
Summary
Adds nullable
nickname(String(100)) to Player model with migration 031, serialization in player profile and admin list responses, and admin-only write guard.Findings
Model & Migration
hometown,custom_notes)Serialization
PlayerProfileResponseincludes nickname -- correctAdminPlayerItemincludes nickname -- correct_player_profile_responsehelper passesplayer.nickname-- correctpublic.py) do NOT expose nickname -- correct (no leakage)Permission Guard
nicknamefromprovideddict before applying -- correct patternregister.py)Tests
test_players.pyrequire_admindependency (matchestest_admin_spa.pypattern)Nits
VERDICT: APPROVED
c69027a07249e2b9ccafView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.