From dbf335a05dde059ea8a018a7efdac6bc7e04ef95 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 25 Jul 2018 07:18:50 +0900 Subject: [PATCH] Refactor: withFile --> requireFile --- src/server/api/call.ts | 2 +- src/server/api/endpoints.ts | 2 +- src/server/api/endpoints/drive/files/create.ts | 2 +- src/server/api/index.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/api/call.ts b/src/server/api/call.ts index 6bab460e15..fc7dff42a7 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -38,7 +38,7 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any) let exec = ep.exec; - if (ep.meta.withFile && file) { + if (ep.meta.requireFile && file) { exec = exec.bind(null, file); } diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 5923694c6f..332a051ae1 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -48,7 +48,7 @@ export interface IEndpointMeta { * ファイルの添付を必要とするか否か * 省略した場合は false として解釈されます。 */ - withFile?: boolean; + requireFile?: boolean; /** * サードパーティアプリからはリクエストすることができないか否か diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index 1c5506f6c4..41b7e04b46 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -19,7 +19,7 @@ export const meta = { max: 100 }, - withFile: true, + requireFile: true, kind: 'drive-write', diff --git a/src/server/api/index.ts b/src/server/api/index.ts index e89988efd0..3ec7a28df9 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -35,7 +35,7 @@ const router = new Router(); /** * Register endpoint handlers */ -endpoints.forEach(endpoint => endpoint.meta.withFile +endpoints.forEach(endpoint => endpoint.meta.requireFile ? router.post(`/${endpoint.name}`, upload.single('file'), handler.bind(null, endpoint)) : router.post(`/${endpoint.name}`, handler.bind(null, endpoint)) );