module.exports = Self => { Self.remoteMethod('upload', { description: 'Uploads an image', accessType: 'WRITE', accepts: [ { arg: 'file', type: 'String', description: 'The image file' }, { arg: 'name', type: 'String', description: 'The image name' }, { arg: 'collectionFk', type: 'String', description: 'The collection' }, { arg: 'ctx', type: 'Object', http: {source: 'context'} } ], returns: { type: 'Boolean', description: 'Success or failed', root: true, }, http: { path: `/upload`, verb: 'POST' } }); Self.upload = async (file, name, collectionFk) => { let $ = Self.app.models; }; };