Overhauled the way in which user details are passed to the frontend

This commit is contained in:
2024-01-19 11:57:53 +00:00
parent 19165220fa
commit b2e32d720c
5 changed files with 55 additions and 10 deletions

View File

@ -50,6 +50,30 @@ class UserController(DatabaseController):
return None
def read_id(self, id: int) -> User | None:
params = [
id
]
cursor = self._conn.execute(
"SELECT * FROM Users WHERE id = ?",
params
)
row = cursor.fetchone()
if row != None:
params = dict(zip(self.FIELDS, row))
# Is user a seller
type = Customer
if row[7] == "Seller":
type = Seller
obj = self.new_instance(type, params)
return obj
return None
def update(self):
print("Doing work")