From 8533663b26b8310065daba99b9c01614de19bd3f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 Oct 2018 09:20:11 +0900 Subject: :v: --- src/server/api/endpoints/users/notes.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/server/api') diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index 002ddf23e5..0b2fc06b04 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -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 -- cgit v1.2.3-freya