2018-06-02 00:51:20 +09:00
|
|
|
//import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
|
|
|
|
import FollowRequest, { pack } from '../../../../../models/follow-request';
|
2018-06-18 09:54:53 +09:00
|
|
|
import { ILocalUser } from '../../../../../models/user';
|
2018-06-02 00:51:20 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all pending received follow requests
|
|
|
|
|
*/
|
2018-06-18 09:54:53 +09:00
|
|
|
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
2018-06-02 00:51:20 +09:00
|
|
|
const reqs = await FollowRequest.find({
|
|
|
|
|
followeeId: user._id
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Send response
|
|
|
|
|
res(await Promise.all(reqs.map(req => pack(req))));
|
|
|
|
|
});
|