fix: add missing AND in dynamic SQL query for orders (#135)
The get_orders and get_orders_for_stall functions were generating malformed SQL when filtering by additional parameters like public_key. Before: WHERE merchant_id = :merchant_id public_key = :public_key After: WHERE merchant_id = :merchant_id AND public_key = :public_key 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
17d13dbe6b
commit
dba3cf2165
1 changed files with 2 additions and 2 deletions
4
crud.py
4
crud.py
|
|
@ -616,7 +616,7 @@ async def get_orders(merchant_id: str, **kwargs) -> list[Order]:
|
|||
rows: list[dict] = await db.fetchall(
|
||||
f"""
|
||||
SELECT * FROM nostrmarket.orders
|
||||
WHERE merchant_id = :merchant_id {q}
|
||||
WHERE merchant_id = :merchant_id {('AND ' + q) if q else ''}
|
||||
ORDER BY event_created_at DESC
|
||||
""",
|
||||
values,
|
||||
|
|
@ -643,7 +643,7 @@ async def get_orders_for_stall(
|
|||
rows: list[dict] = await db.fetchall(
|
||||
f"""
|
||||
SELECT * FROM nostrmarket.orders
|
||||
WHERE merchant_id = :merchant_id AND stall_id = :stall_id {q}
|
||||
WHERE merchant_id = :merchant_id AND stall_id = :stall_id {('AND ' + q) if q else ''}
|
||||
ORDER BY time DESC
|
||||
""",
|
||||
values,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue