WIP: Add light/dark theme with toggle in navbar (dark theme styling incomplete - dont care for now)
This commit is contained in:
10
db.py
10
db.py
@@ -166,18 +166,22 @@ ORDER BY invocation_time DESC""", [http_function_id])
|
||||
|
||||
def get_user(self, user_id):
|
||||
user = self.execute(
|
||||
'SELECT id, username, password_hash, created_at FROM users WHERE id=%s', [int(user_id)], one=True)
|
||||
'SELECT id, username, password_hash, created_at, theme_preference FROM users WHERE id=%s', [int(user_id)], one=True)
|
||||
return user
|
||||
|
||||
def get_user_by_username(self, username):
|
||||
user = self.execute(
|
||||
'SELECT id, username, password_hash, created_at FROM users WHERE username=%s', [username], one=True)
|
||||
'SELECT id, username, password_hash, created_at, theme_preference FROM users WHERE username=%s', [username], one=True)
|
||||
return user
|
||||
|
||||
def create_new_user(self, username, password_hash):
|
||||
new_user = self.execute(
|
||||
'INSERT INTO users (username, password_hash) VALUES (%s, %s) RETURNING id, username, password_hash, created_at', [username, password_hash], commit=True, one=True)
|
||||
'INSERT INTO users (username, password_hash, theme_preference) VALUES (%s, %s, %s) RETURNING id, username, password_hash, created_at, theme_preference', [username, password_hash, 'light'], commit=True, one=True)
|
||||
return new_user
|
||||
|
||||
def update_user_theme_preference(self, user_id, theme):
|
||||
self.execute(
|
||||
'UPDATE users SET theme_preference=%s WHERE id=%s', [theme, user_id], commit=True)
|
||||
|
||||
def get_http_function_history(self, function_id):
|
||||
http_function_history = self.execute(
|
||||
|
||||
Reference in New Issue
Block a user