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:
parent
879a58992f
commit
a1b4538954
@ -44,7 +44,7 @@ class CollectionIn(BaseModel):
|
||||
@router.get("/collections")
|
||||
async def list_collections(ident=Depends(require_token), db=Depends(get_db)):
|
||||
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
|
||||
FROM virtual_collection ORDER BY priority DESC, name
|
||||
"""))).mappings()
|
||||
@ -157,7 +157,7 @@ async def locate(release_id: int | None = Query(None), sku: str | None = Query(N
|
||||
cols = (await db.execute(text("""
|
||||
SELECT id, name, color, crate_ids, genre_ids, style_ids, price_min::float AS pmin,
|
||||
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()
|
||||
for c in cols:
|
||||
gmin, gmax = c["pmin"], c["pmax"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user