Added page that shows a sellers own products

This commit is contained in:
2024-01-22 17:53:56 +00:00
parent dc6a3b3581
commit aaaf7e4829
2 changed files with 51 additions and 7 deletions

View File

@ -85,6 +85,32 @@ class ProductController(DatabaseController):
return products
def read_user(self, user_id: int) -> list[Product] | None:
params = [
user_id
]
cursor = self._conn.execute(
"""SELECT * FROM Products
WHERE sellerID = ?
""",
params
)
rows = cursor.fetchall()
if len(rows) == 0:
return None
products = list()
# Create an object for each row
for product in rows:
params = dict(zip(self.FIELDS, product))
obj = self.new_instance(Product, params)
products.append(obj)
return products
def update(self):
print("Doing work")