salix/modules/worker/back/methods/worker-time-control/getClockIn.js

33 lines
862 B
JavaScript
Raw Normal View History

module.exports = Self => {
2023-11-28 13:48:03 +00:00
Self.remoteMethod('getClockIn', {
description: 'Shows the clockings for each day, in columns per day',
accessType: 'READ',
accepts: [
{
arg: 'workerFk',
type: 'number',
required: true,
},
2023-11-28 13:48:03 +00:00
],
http: {
path: `/getClockIn`,
2023-11-28 13:48:03 +00:00
verb: 'GET'
},
returns: {
type: ['Object'],
root: true
},
});
2023-11-28 13:48:03 +00:00
Self.getClockIn = async(workerFk, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
2023-12-07 13:47:22 +00:00
const query = `CALL vn.workerTimeControl_getClockIn(?, ?)`;
const [result] = await Self.rawSql(query, [workerFk, Date.vnNew()], myOptions);
2023-11-28 13:48:03 +00:00
return result;
};
};