diff --git a/resolvers/follower.py b/resolvers/follower.py index 3f44c5c2..51bca292 100644 --- a/resolvers/follower.py +++ b/resolvers/follower.py @@ -92,6 +92,7 @@ async def follow( session.query(follower_class) .where( follower_class.follower == follower_id, # type: ignore[attr-defined] + follower_class.following == entity_id, # type: ignore[attr-defined] getattr(follower_class, entity_type) == entity_id, # type: ignore[attr-defined] ) .first() @@ -214,7 +215,9 @@ async def unfollow( .where( and_( follower_class.follower == follower_id, # type: ignore[attr-defined] - getattr(follower_class, entity_type) == entity_id, # type: ignore[attr-defined] + follower_class.following == entity_id + if entity_type == "AUTHOR" + else follower_class.topic == entity_id, # type: ignore[attr-defined] ) ) .first()