mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +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,
|
displayName: true,
|
||||||
username: true,
|
username: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
|
followers: true,
|
||||||
|
following: true,
|
||||||
posts: {
|
posts: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
@ -33,7 +35,16 @@ async function userFetchUserService(
|
||||||
return new Error('User not found')
|
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
|
export default userFetchUserService
|
||||||
|
|
Loading…
Reference in a new issue