feat: add products table

This commit is contained in:
Vlad Stan 2023-03-02 18:05:49 +02:00
parent e17cea65cb
commit 4bad9655be
4 changed files with 150 additions and 10 deletions

View file

@ -228,3 +228,11 @@ async def get_product(user_id: str, product_id: str) -> Optional[Product]:
product = Product.from_row(row) if row else None
return product
async def get_products(user_id: str, stall_id: str) -> List[Product]:
rows = await db.fetchall(
"SELECT * FROM nostrmarket.products WHERE user_id = ? AND stall_id = ?",
(user_id, stall_id),
)
return [Product.from_row(row) for row in rows]