Refactor: withFile --> requireFile
This commit is contained in:
		
							parent
							
								
									ad5a7e9d70
								
							
						
					
					
						commit
						dbf335a05d
					
				
					 4 changed files with 4 additions and 4 deletions
				
			
		|  | @ -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); | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ export interface IEndpointMeta { | |||
| 	 * ファイルの添付を必要とするか否か | ||||
| 	 * 省略した場合は false として解釈されます。 | ||||
| 	 */ | ||||
| 	withFile?: boolean; | ||||
| 	requireFile?: boolean; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * サードパーティアプリからはリクエストすることができないか否か | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ export const meta = { | |||
| 		max: 100 | ||||
| 	}, | ||||
| 
 | ||||
| 	withFile: true, | ||||
| 	requireFile: true, | ||||
| 
 | ||||
| 	kind: 'drive-write', | ||||
| 
 | ||||
|  |  | |||
|  | @ -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)) | ||||
| ); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue