diff --git a/backend/matcha/db/last_connection.py b/backend/matcha/db/last_connection.py index fd753788..d8793f14 100644 --- a/backend/matcha/db/last_connection.py +++ b/backend/matcha/db/last_connection.py @@ -1,5 +1,6 @@ from matcha.db.utils import ( db_fetchone, + db_query, ) @@ -13,3 +14,19 @@ def db_get_last_connection(id_user: int) -> str: """ return db_fetchone(query, (id_user,))[0].timestamp() + + +def db_update_last_connection(id_user: int) -> str: + query = """ + UPDATE + users + SET + last_connection_at + = + GETDATE() + WHERE + id = %s + ; + """ + + return db_query(query, (id_user,))