Worker calendar rework #645

Merged
carlosjr merged 15 commits from 2567-calendar_rework into dev 2021-06-14 10:04:45 +00:00
1 changed files with 6 additions and 13 deletions
Showing only changes of commit b77ecc2c06 - Show all commits

View File

@ -1,8 +1,8 @@
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('absences', { Self.remoteMethodCtx('holidays', {
description: 'Returns an array of absences from an specified worker', description: 'Returns data - Change me',
accepts: [{ accepts: [{
arg: 'businessFk', arg: 'businessFk',
type: 'number', type: 'number',
@ -14,23 +14,16 @@ module.exports = Self => {
required: true, required: true,
}], }],
returns: [{ returns: [{
arg: 'calendar' type: 'object',
}, root: true
{
arg: 'absences',
type: 'number'
},
{
arg: 'holidays',
type: 'number'
}], }],
http: { http: {
path: `/absences`, path: `/holidays`,
verb: 'GET' verb: 'GET'
} }
}); });
Self.absences = async(ctx, businessFk, year) => { Self.holidays = async(ctx, businessFk, year) => {
const models = Self.app.models; const models = Self.app.models;
const calendar = {totalHolidays: 0, holidaysEnjoyed: 0}; const calendar = {totalHolidays: 0, holidaysEnjoyed: 0};
const holidays = []; const holidays = [];