module.exports = Self => { Self.remoteMethod('setPassword', { description: 'Sets the user password', accepts: [ { arg: 'id', type: 'Number', description: 'The user id', http: {source: 'path'} }, { arg: 'newPassword', type: 'String', description: 'The new password', required: true } ], returns: { type: 'Boolean', root: true }, http: { path: `/:id/setPassword`, verb: 'PATCH' } }); Self.setPassword = async function(id, newPassword) { let params = [id, newPassword]; await Self.rawSql(`CALL account.user_setPassword(?, ?)`, params); return true; }; };