mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 01:13:48 +01:00
Improve readability
This commit is contained in:
parent
e8e1b8fc58
commit
c1ca137547
@ -25,21 +25,18 @@ export default ({ data }) => Post.findOne({ _id: data.id }).then(post => {
|
|||||||
User.findOne({ _id: post.userId }),
|
User.findOne({ _id: post.userId }),
|
||||||
|
|
||||||
// Fetch all followers
|
// Fetch all followers
|
||||||
Following.aggregate([
|
Following.aggregate([{
|
||||||
{
|
$lookup: {
|
||||||
$lookup: {
|
from: 'users',
|
||||||
from: 'users',
|
localField: 'followerId',
|
||||||
localField: 'followerId',
|
foreignField: '_id',
|
||||||
foreignField: '_id',
|
as: 'follower'
|
||||||
as: 'follower'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
followeeId: post.userId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
], {
|
}, {
|
||||||
|
$match: {
|
||||||
|
followeeId: post.userId
|
||||||
|
}
|
||||||
|
}], {
|
||||||
_id: false
|
_id: false
|
||||||
})
|
})
|
||||||
]).then(([user, followers]) => Promise.all(followers.map(following => {
|
]).then(([user, followers]) => Promise.all(followers.map(following => {
|
||||||
|
Loading…
Reference in New Issue
Block a user