mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 22:17:30 -07:00
Improve readability
This commit is contained in:
parent
e8e1b8fc58
commit
c1ca137547
1 changed files with 11 additions and 14 deletions
|
@ -25,21 +25,18 @@ export default ({ data }) => Post.findOne({ _id: data.id }).then(post => {
|
|||
User.findOne({ _id: post.userId }),
|
||||
|
||||
// Fetch all followers
|
||||
Following.aggregate([
|
||||
{
|
||||
$lookup: {
|
||||
from: 'users',
|
||||
localField: 'followerId',
|
||||
foreignField: '_id',
|
||||
as: 'follower'
|
||||
}
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
followeeId: post.userId
|
||||
}
|
||||
Following.aggregate([{
|
||||
$lookup: {
|
||||
from: 'users',
|
||||
localField: 'followerId',
|
||||
foreignField: '_id',
|
||||
as: 'follower'
|
||||
}
|
||||
], {
|
||||
}, {
|
||||
$match: {
|
||||
followeeId: post.userId
|
||||
}
|
||||
}], {
|
||||
_id: false
|
||||
})
|
||||
]).then(([user, followers]) => Promise.all(followers.map(following => {
|
||||
|
|
Loading…
Reference in a new issue