32 lines
902 B
JavaScript
32 lines
902 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.Account.findById(id, {fields: ['name']});
|
|
await Self.sync(user.name, password, force);
|
|
};
|
|
};
|