update-last-seen-author
All checks were successful
deploy / deploy (push) Successful in 1m24s

This commit is contained in:
Untone 2023-12-18 01:20:00 +03:00
parent a6c5243c06
commit a2ab5e8473
2 changed files with 5 additions and 1 deletions

1
.gitignore vendored
View File

@ -148,5 +148,4 @@ migration/content/**/*.md
dev-server.pid dev-server.pid
backups/ backups/
poetry.lock poetry.lock
.venv
.ruff_cache .ruff_cache

View File

@ -1,3 +1,4 @@
import time
from typing import List from typing import List
from sqlalchemy import select from sqlalchemy import select
@ -94,6 +95,10 @@ async def get_my_followed(_, info):
with local_session() as session: with local_session() as session:
author = session.query(Author).filter(Author.user == user_id).first() author = session.query(Author).filter(Author.user == user_id).first()
if author: if author:
# update author's last_seen timestamp
author.last_seen = time.time()
session.add(author)
authors_query = ( authors_query = (
select(Author) select(Author)
.join(AuthorFollower, AuthorFollower.follower == Author.id) .join(AuthorFollower, AuthorFollower.follower == Author.id)