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
backups/
poetry.lock
.venv
.ruff_cache

View File

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