fix(api): improve Station router - review feedback

- Rinomina _RecipeSummary -> RecipeSummary: il leading underscore
  segnalava "privato" ma la classe e usata come response_model pubblico
  ed esposta nell'OpenAPI schema.
- Aggiunge commento esplicativo sopra /by-code/{code}/recipes sul perche
  l'ordine di dichiarazione conta (protezione gia data dal tipo int di
  station_id, ma esplicito per prevenire regressioni durante refactor).
- Detail message del 404 by-code uniformato a "Station not found"
  (senza distinguere not-found vs inactive, evita leak di esistenza).
- Aggiunge 3 test mancanti sul router:
  * test_admin_can_list_stations (copertura happy path + active_only)
  * test_assign_recipe_not_found_returns_404
  * test_duplicate_assignment_returns_409

Feedback da code-reviewer su Task 5. Full suite: 11/11 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 22:46:54 +02:00
parent 338f21fba0
commit a79ab37add
3 changed files with 79 additions and 8 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ class StationRecipeAssignmentResponse(BaseModel):
assigned_at: datetime
class _RecipeSummary(BaseModel):
class RecipeSummary(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
code: str
@@ -54,4 +54,4 @@ class _RecipeSummary(BaseModel):
class StationWithRecipesResponse(StationResponse):
recipes: list[_RecipeSummary] = Field(default_factory=list)
recipes: list[RecipeSummary] = Field(default_factory=list)