save track logs to logged in user

+ rewrite migration collection
+ prevent logging invalid track logs
+ add jsoni
This commit is contained in:
cwilvx
2024-05-18 17:16:07 +03:00
parent f8f07c2116
commit 30768dd5d6
10 changed files with 160 additions and 42 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ from app.db.sqlite.utils import SQLiteManager
class SQLiteTrackLogger:
@classmethod
def insert_track(cls, trackhash: str, duration: int, source: str, timestamp: int):
def insert_track(cls, trackhash: str, duration: int, source: str, timestamp: int, userid: int):
"""
Inserts a track into the database
"""
@@ -18,7 +18,7 @@ class SQLiteTrackLogger:
) VALUES(?,?,?,?,?)
"""
cur.execute(sql, (trackhash, duration, timestamp, source, 0))
cur.execute(sql, (trackhash, duration, timestamp, source, userid))
lastrowid = cur.lastrowid
return lastrowid