feat: delete product

This commit is contained in:
Vlad Stan 2023-03-02 18:15:17 +02:00
parent 4bad9655be
commit 1e6aaf8436
4 changed files with 51 additions and 19 deletions

11
crud.py
View file

@ -106,6 +106,7 @@ async def get_zones(user_id: str) -> List[Zone]:
async def delete_zone(zone_id: str) -> None:
# todo: add user_id
await db.execute("DELETE FROM nostrmarket.zones WHERE id = ?", (zone_id,))
@ -236,3 +237,13 @@ async def get_products(user_id: str, stall_id: str) -> List[Product]:
(user_id, stall_id),
)
return [Product.from_row(row) for row in rows]
async def delete_product(user_id: str, product_id: str) -> None:
await db.execute(
"DELETE FROM nostrmarket.products WHERE user_id =? AND id = ?",
(
user_id,
product_id,
),
)