salix/modules/account/back/methods/user-account/sync-by-id.js

32 lines
901 B
JavaScript

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'
}, {
arg: 'force',
type: 'boolean',
description: 'Whether to force synchronization'
}
],
http: {
path: `/:id/syncById`,
verb: 'PATCH'
}
});
Self.syncById = async function(id, password, force) {
let user = await Self.app.models.VnUser.findById(id, {fields: ['name']});
await Self.sync(user.name, password, force);
};
};