feat: updated fetch-info

updated fetch-info to return user's followers and following
This commit is contained in:
Hackntosh 2023-10-01 14:46:14 -03:00
parent fe904c26c9
commit 2ad6018806

View file

@ -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