Fix #146: Add missing icon field to badges API response #147
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "typosaurus/ticket-146"
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?
Resolves #146.
Plan
Plan: Add
iconfield to badge API responseUpdate schema (
devplacepy/schemas/content.pylines 68–71)Add
icon: Optional[str] = NonetoBadgeOut. No other fields or aliases needed.Enrich badge rows in profile route (
devplacepy/routers/profile/index.pyaround line 203)After the
list(get_table("badges").find(...))call (line 203) and before the response context is built, insert a loop:The
get_badgefunction is already imported (used elsewhere). This makesiconavailable in each row dict soBadgeOutserializes it into JSON.(Optional) Add API test (
tests/api/profile/index.py)Add a test that fetches a profile with
Accept: application/jsonand asserts every badge in the response has aniconfield (non‑empty string). This is recommended but not mandatory for the fix.Run verification
Execute the project’s test command targeting relevant test files:
Do not include e2e tests (known flakiness unrelated to this change).
Definition of Done
BadgeOutschema containsicon: Optional[str] = None.iconfrom the catalog before response serialization.iconfor every badge (verified via a new or existing API test).tests/api/profile/index.py,tests/unit/utils.py) pass with exit code 0.Opened automatically by Typosaurus.