Added page that shows a sellers own products
This commit is contained in:
@ -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")
|
||||
|
||||
|
Reference in New Issue
Block a user