Merge pull request #148 from BenGWeeks/fix/orders-by-customer-pubkey
fix: add missing AND in dynamic SQL query for orders
This commit is contained in:
commit
053dcd1785
1 changed files with 3 additions and 2 deletions
5
crud.py
5
crud.py
|
|
@ -616,7 +616,7 @@ async def get_orders(merchant_id: str, **kwargs) -> list[Order]:
|
||||||
rows: list[dict] = await db.fetchall(
|
rows: list[dict] = await db.fetchall(
|
||||||
f"""
|
f"""
|
||||||
SELECT * FROM nostrmarket.orders
|
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
|
ORDER BY event_created_at DESC
|
||||||
""",
|
""",
|
||||||
values,
|
values,
|
||||||
|
|
@ -640,10 +640,11 @@ async def get_orders_for_stall(
|
||||||
continue
|
continue
|
||||||
values[field[0]] = field[1]
|
values[field[0]] = field[1]
|
||||||
|
|
||||||
|
q_clause = f"AND {q}" if q else ""
|
||||||
rows: list[dict] = await db.fetchall(
|
rows: list[dict] = await db.fetchall(
|
||||||
f"""
|
f"""
|
||||||
SELECT * FROM nostrmarket.orders
|
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 {q_clause}
|
||||||
ORDER BY time DESC
|
ORDER BY time DESC
|
||||||
""",
|
""",
|
||||||
values,
|
values,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue