Properly update last_accessed time

This commit is contained in:
Spotlight 2024-09-23 02:44:09 -05:00
parent 45aa4c2e74
commit 51a6e108fb
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC

View File

@ -128,13 +128,12 @@ def createUser(friendCode:int, network:NetworkType, addNewInstance:bool = False)
db.session.commit()
except Exception as e:
if 'UNIQUE constraint failed: friends.friendCode' in str(e):
stmt = (
select(Friend)
db.session.execute(
update(Friend)
.where(Friend.friend_code == str(friendCode).zfill(12))
.where(Friend.network == network)
)
friend = db.session.scalar(stmt)
friend.last_accessed = time.time()
.values(last_accessed=time.time())
)
db.session.commit()
def fetchBearerToken(code:str):