This commit is contained in:
syuilo
2018-10-19 09:20:11 +09:00
parent 0a4015b8a2
commit 8533663b26
2 changed files with 26 additions and 3 deletions

View File

@ -99,6 +99,12 @@ export const meta = {
'ja-JP': 'true にすると、ファイルが添付された投稿だけ取得します (このパラメータは廃止予定です。代わりに withFiles を使ってください。)'
}
}),
fileType: $.arr($.str).optional.note({
desc: {
'ja-JP': '指定された種類のファイルが添付された投稿のみを取得します'
}
}),
}
};
@ -137,7 +143,8 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
const query = {
deletedAt: null,
userId: user._id
userId: user._id,
visibility: { $in: ['public', 'home'] }
} as any;
if (ps.sinceId) {
@ -172,6 +179,14 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
$ne: []
};
}
if (ps.fileType) {
query.fileIds = { $exists: true, $ne: [] };
query['_files.contentType'] = {
$in: ps.fileType
};
}
//#endregion
// Issue query