module.exports = Self => { Self.remoteMethod('syncById', { description: 'Synchronizes the user with the other user databases', accepts: [ { arg: 'id', type: 'number', description: 'The user id', required: true }, { arg: 'password', type: 'string', description: 'The password' } ], http: { path: `/:id/syncById`, verb: 'PATCH' } }); Self.syncById = async function(id, password) { let user = await Self.app.models.Account.findById(id, {fields: ['name']}); await Self.sync(user.name, password); }; };