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
|
|
|
|
2018-07-17 04:36:44 +09:00
|
|
|
export const meta = {
|
|
|
|
|
desc: {
|
|
|
|
|
ja: '自分に届いたフォローリクエストの一覧を取得します。',
|
|
|
|
|
en: 'Get all pending received follow requests.'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
|
|
|
|
|
|
kind: 'following-read'
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-06 02:58:29 +09:00
|
|
|
export default (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))));
|
|
|
|
|
});
|