Skip to content

Commit

Permalink
db(last_connection): update
Browse files Browse the repository at this point in the history
  • Loading branch information
t-h2o authored and RobinBurri committed Dec 18, 2024
1 parent c88718d commit 0d7f309
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/matcha/db/last_connection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from matcha.db.utils import (
db_fetchone,
db_query,
)


Expand All @@ -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,))

0 comments on commit 0d7f309

Please sign in to comment.