Introduce processor
This commit is contained in:
parent
68ce6d5748
commit
90f8fe7e53
582 changed files with 246 additions and 188 deletions
|
|
@ -1,26 +0,0 @@
|
|||
import * as mongodb from 'mongodb';
|
||||
import Following from '../models/following';
|
||||
|
||||
export default async (me: mongodb.ObjectID, includeMe: boolean = true) => {
|
||||
// Fetch relation to other users who the I follows
|
||||
// SELECT followee
|
||||
const myfollowing = await Following
|
||||
.find({
|
||||
follower_id: me,
|
||||
// 削除されたドキュメントは除く
|
||||
deleted_at: { $exists: false }
|
||||
}, {
|
||||
fields: {
|
||||
followee_id: true
|
||||
}
|
||||
});
|
||||
|
||||
// ID list of other users who the I follows
|
||||
const myfollowingIds = myfollowing.map(follow => follow.followee_id);
|
||||
|
||||
if (includeMe) {
|
||||
myfollowingIds.push(me);
|
||||
}
|
||||
|
||||
return myfollowingIds;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue