featured-id-patch
All checks were successful
Deploy to core / deploy (push) Successful in 1m40s

This commit is contained in:
2024-02-02 15:03:44 +03:00
parent bd5f910f8c
commit c00361b2ec
19 changed files with 640 additions and 798 deletions

View File

@@ -82,35 +82,6 @@ async def update_profile(_, info, profile):
return {'error': None, 'author': author}
# for mutation.field("follow")
def author_follow(follower_id, slug):
try:
with local_session() as session:
author = session.query(Author).where(Author.slug == slug).one()
af = AuthorFollower(follower=follower_id, author=author.id)
session.add(af)
session.commit()
return True
except Exception:
return False
# for mutation.field("unfollow")
def author_unfollow(follower_id, slug):
with local_session() as session:
flw = (
session.query(AuthorFollower)
.join(Author, Author.id == AuthorFollower.author)
.filter(and_(AuthorFollower.follower == follower_id, Author.slug == slug))
.first()
)
if flw:
session.delete(flw)
session.commit()
return True
return False
# TODO: caching query
@query.field('get_authors_all')
async def get_authors_all(_, _info):