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; }; };