From 4be7d7b1e9574598fc3c4bb7c50d7729d0da7d9b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 24 Apr 2019 14:54:06 +0900 Subject: [PATCH] Update attached-notes.ts --- .../api/endpoints/drive/files/attached-notes.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/server/api/endpoints/drive/files/attached-notes.ts b/src/server/api/endpoints/drive/files/attached-notes.ts index 6bfc95ce8..f770bc713 100644 --- a/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/src/server/api/endpoints/drive/files/attached-notes.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import { ID } from '../../../../../misc/cafy-id'; import define from '../../../define'; import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { DriveFiles, Notes } from '../../../../../models'; import { types, bool } from '../../../../../misc/schema'; export const meta = { @@ -59,8 +59,11 @@ export default define(meta, async (ps, user) => { throw new ApiError(meta.errors.noSuchFile); } - /* v11 TODO - return await packMany(file.metadata.attachedNoteIds || [], user, { + const notes = await Notes.createQueryBuilder('note') + .where(':file = ANY(note.fileIds)', { file: file.id }) + .getMany(); + + return await Notes.packMany(notes, user, { detail: true - });*/ + }); });