mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 09:31:16 +00:00
Updated Fetch User Service
This commit is contained in:
parent
02e4075ab2
commit
119ab37daf
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue