fix(collections): is_active is int not bool — cast in queries

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
type-two 2026-06-22 20:58:50 +10:00
parent 879a58992f
commit a1b4538954

View File

@ -44,7 +44,7 @@ class CollectionIn(BaseModel):
@router.get("/collections") @router.get("/collections")
async def list_collections(ident=Depends(require_token), db=Depends(get_db)): async def list_collections(ident=Depends(require_token), db=Depends(get_db)):
rows = (await db.execute(text(""" rows = (await db.execute(text("""
SELECT id, name, color, priority, (is_active = 1 OR is_active = true) AS is_active, SELECT id, name, color, priority, (is_active::int <> 0) AS is_active,
crate_ids, style_ids, genre_ids, price_min::float, price_max::float, year_min, year_max crate_ids, style_ids, genre_ids, price_min::float, price_max::float, year_min, year_max
FROM virtual_collection ORDER BY priority DESC, name FROM virtual_collection ORDER BY priority DESC, name
"""))).mappings() """))).mappings()
@ -157,7 +157,7 @@ async def locate(release_id: int | None = Query(None), sku: str | None = Query(N
cols = (await db.execute(text(""" cols = (await db.execute(text("""
SELECT id, name, color, crate_ids, genre_ids, style_ids, price_min::float AS pmin, SELECT id, name, color, crate_ids, genre_ids, style_ids, price_min::float AS pmin,
price_max::float AS pmax, year_min, year_max price_max::float AS pmax, year_min, year_max
FROM virtual_collection WHERE is_active = 1 OR is_active = true ORDER BY priority DESC, name FROM virtual_collection WHERE is_active::int <> 0 ORDER BY priority DESC, name
"""))).mappings() """))).mappings()
for c in cols: for c in cols:
gmin, gmax = c["pmin"], c["pmax"] gmin, gmax = c["pmin"], c["pmax"]