salix/modules/account/back/methods/role-inherit/sync.js

28 lines
590 B
JavaScript

const SyncEngine = require('../../util/sync-engine');
module.exports = Self => {
Self.remoteMethod('sync', {
description: 'Synchronizes the user with the other user databases',
http: {
path: `/sync`,
verb: 'PATCH'
}
});
Self.sync = async function() {
let engine = new SyncEngine();
await engine.init(Self.app.models);
let err;
try {
await engine.syncRoles();
} catch (e) {
err = e;
}
await engine.deinit();
if (err) throw err;
};
};