Updated Fetch User Service

This commit is contained in:
Hackntosh 2023-09-07 11:25:34 -03:00
parent 02e4075ab2
commit 119ab37daf

View file

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