From 119ab37daf25cdf452fbda0a70982e246ab38fcf Mon Sep 17 00:00:00 2001 From: CookieDasora Date: Thu, 7 Sep 2023 11:25:34 -0300 Subject: [PATCH] Updated Fetch User Service --- src/services/users/fetch-user.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/services/users/fetch-user.ts b/src/services/users/fetch-user.ts index 0583daa..966e00f 100644 --- a/src/services/users/fetch-user.ts +++ b/src/services/users/fetch-user.ts @@ -13,6 +13,8 @@ async function userFetchUserService( displayName: true, username: true, createdAt: true, + followers: true, + following: true, posts: { select: { id: true, @@ -33,7 +35,16 @@ async function userFetchUserService( return new Error('User not found') } - return user + const followers = user.followers.length + const following = user.following.length + + const info = { + ...user, + followers, + following, + } + + return info } export default userFetchUserService