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() db.session.commit()
except Exception as e: except Exception as e:
if 'UNIQUE constraint failed: friends.friendCode' in str(e): if 'UNIQUE constraint failed: friends.friendCode' in str(e):
stmt = ( db.session.execute(
select(Friend) update(Friend)
.where(Friend.friend_code == str(friendCode).zfill(12)) .where(Friend.friend_code == str(friendCode).zfill(12))
.where(Friend.network == network) .where(Friend.network == network)
.values(last_accessed=time.time())
) )
friend = db.session.scalar(stmt)
friend.last_accessed = time.time()
db.session.commit() db.session.commit()
def fetchBearerToken(code:str): def fetchBearerToken(code:str):