Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var ctrlFactory = require('restitute').controller;
function getController() {
ctrlFactory.get.call(this, '/rest/user/settings');
this.controllerAction = function() {
this.jsonService(this.service('user/settings/get', { user: this.req.user.id }));
};
}
getController.prototype = new ctrlFactory.get();
function updateController() {
ctrlFactory.update.call(this, '/rest/user/settings');
var controller = this;
this.controllerAction = function() {
// since service is query independant, we have to give
// the additional parameter
controller.jsonService(
controller.service('user/settings/save', {
.select('name')
.exec()
.then(calendars => {
invitation.scheduleCalendars = calendars;
return invitation;
});
});
})
.then(invitation => {
controller.res.statusCode = 200;
controller.res.json(invitation);
})
.catch(err => controller.error(err.message));
};
}
getController.prototype = new ctrlFactory.get();
/**
* A POST on anonymous/invitation create the user
*
*/
function createController() {
ctrlFactory.create.call(this, '/rest/anonymous/invitation');
var controller = this;
this.controllerAction = function() {
const gt = controller.req.app.utility.gettext;
this.controllerAction = function() {
this.jsonService(this.service('admin/compulsoryleaves/list'));
};
}
listController.prototype = new ctrlFactory.list();
function getController() {
ctrlFactory.get.call(this, '/rest/admin/compulsoryleaves/:id');
this.controllerAction = function() {
this.jsonService(this.service('admin/compulsoryleaves/get'));
};
}
getController.prototype = new ctrlFactory.get();
function save() {
this.jsonService(this.service('admin/compulsoryleaves/save', { userCreated: this.req.user }));
}
function createController() {
ctrlFactory.create.call(this, '/rest/admin/compulsoryleaves');
this.controllerAction = save;
}
createController.prototype = new ctrlFactory.create();
function updateController() {
ctrlFactory.update.call(this, '/rest/admin/compulsoryleaves/:id');
this.controllerAction = save;
}
this.controllerAction = function() {
this.jsonService(this.service('manager/waitingrequests/list'));
};
}
listController.prototype = new ctrlFactory.list();
function getController() {
ctrlFactory.get.call(this, '/rest/admin/waitingrequests/:id');
this.controllerAction = function() {
this.jsonService(this.service('manager/waitingrequests/get'));
};
}
getController.prototype = new ctrlFactory.get();
/**
* Confirm or reject a waiting request instead of a manager
*/
function updateController() {
ctrlFactory.update.call(this, '/rest/admin/waitingrequests/:id');
var controller = this;
this.controllerAction = function() {
controller.jsonService(
controller.service('manager/waitingrequests/save')
);
};
}
updateController.prototype = new ctrlFactory.update();
this.controllerAction = function() {
this.jsonService(this.service('admin/rightrenewals/list'));
};
}
listController.prototype = new ctrlFactory.list();
function getController() {
ctrlFactory.get.call(this, '/rest/admin/rightrenewals/:id');
this.controllerAction = function() {
this.jsonService(this.service('admin/rightrenewals/get'));
};
}
getController.prototype = new ctrlFactory.get();
function save() {
this.jsonService(this.service('admin/rightrenewals/save'));
}
function createController() {
ctrlFactory.create.call(this, '/rest/admin/rightrenewals');
this.controllerAction = save;
}
createController.prototype = new ctrlFactory.create();
function updateController() {
ctrlFactory.update.call(this, '/rest/admin/rightrenewals/:id');
this.controllerAction = save;
}