Overhauled the way in which user details are passed to the frontend
This commit is contained in:
@ -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")
|
||||
|
||||
|
Reference in New Issue
Block a user