store: Fix: dead roster CSV fields in paper-dynasty-database cards endpoint

This commit is contained in:
Cal Corum 2026-03-03 12:07:05 -06:00
parent 2710e2e60f
commit c7cacb9a60

View File

@ -0,0 +1,34 @@
---
id: 61b618e7-6c6a-46be-9dec-b31b57cb19fe
type: fix
title: "Fix: dead roster CSV fields in paper-dynasty-database cards endpoint"
tags: [paper-dynasty, paper-dynasty-database, fastapi, python, fix, dead-code, csv, card-model]
importance: 0.55
confidence: 0.8
created: "2026-03-03T18:07:05.018372+00:00"
updated: "2026-03-03T18:07:05.018372+00:00"
---
## Problem
`app/routers_v2/cards.py``v1_cards_get_one` endpoint's CSV branch accessed `this_card.roster1.name`, `this_card.roster2.name`, `this_card.roster3.name`. The `Card` model has no such fields, so any `GET /api/v2/cards/{id}?csv=true` request would raise `AttributeError` at runtime.
## Root Cause
The CSV code was written against an older schema that had roster foreign keys on `Card`. Those fields were removed from the model but the CSV export code was never updated.
## Solution
Removed the three dead columns from the CSV header row and data row. The output now reflects only fields that exist on `Card`: `id`, `player`, `team`, `pack`, `value`.
## Files Changed
- `app/routers_v2/cards.py` lines 144146
## Note
The `v1_cards_patch` endpoint also accepts `roster1_id`, `roster2_id`, `roster3_id` params that are silently ignored (no assignment in handler body) — dead API surface but not a runtime error.
## PR
https://git.manticorum.com/cal/paper-dynasty-database/pulls/35