From 2b750304467072a3b9b28a190b026e3742fc7d8b Mon Sep 17 00:00:00 2001 From: Luis Cusihuaman Date: Tue, 5 Dec 2023 21:14:46 -0300 Subject: [PATCH] feat(auth): is_followed_back --- identity_socializer/web/api/auth/schema.py | 1 + identity_socializer/web/api/utils.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/identity_socializer/web/api/auth/schema.py b/identity_socializer/web/api/auth/schema.py index 29bbcee..626eb76 100644 --- a/identity_socializer/web/api/auth/schema.py +++ b/identity_socializer/web/api/auth/schema.py @@ -46,6 +46,7 @@ class AppUserModel(BaseModel): profile_photo_id: Optional[str] ubication: Optional[str] is_followed: Optional[bool] + is_followed_back: Optional[bool] = False blocked: bool = False certified: bool = False model_config = ConfigDict(from_attributes=True) diff --git a/identity_socializer/web/api/utils.py b/identity_socializer/web/api/utils.py index 18962fc..e1f798f 100644 --- a/identity_socializer/web/api/utils.py +++ b/identity_socializer/web/api/utils.py @@ -27,6 +27,7 @@ async def complete_user( ) -> AppUserModel: """Returns a user with additional information.""" is_followed = await relationship_dao.is_followed_by_user(current_user_id, user.id) + is_followed_back = await relationship_dao.is_followed_by_user(user.id, current_user_id) return AppUserModel( id=user.id, @@ -39,5 +40,6 @@ async def complete_user( profile_photo_id=user.profile_photo_id, ubication=user.ubication, is_followed=is_followed, + is_followed_back=is_followed_back, blocked=user.blocked, )