diff --git a/src/services/users/fetch-info.ts b/src/services/users/fetch-info.ts index b16c686..fb62477 100644 --- a/src/services/users/fetch-info.ts +++ b/src/services/users/fetch-info.ts @@ -8,10 +8,13 @@ async function userFetchInfoService( username, }, select: { + id: true, profileImage: true, displayName: true, username: true, createdAt: true, + followers: true, + following: true, posts: { select: { id: true, @@ -32,7 +35,16 @@ async function userFetchInfoService( 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 userFetchInfoService