2023-11-23 12:25:31 +00:00
|
|
|
module.exports = Self => {
|
2023-11-28 13:48:03 +00:00
|
|
|
Self.remoteMethod('getClockIn', {
|
2023-11-23 12:25:31 +00:00
|
|
|
description: 'Shows the clockings for each day, in columns per day',
|
|
|
|
accessType: 'READ',
|
|
|
|
accepts: [
|
|
|
|
{
|
|
|
|
arg: 'workerFk',
|
2024-01-10 14:39:35 +00:00
|
|
|
type: 'number',
|
2023-11-23 12:25:31 +00:00
|
|
|
required: true,
|
|
|
|
},
|
2023-11-28 13:48:03 +00:00
|
|
|
|
2023-11-23 12:25:31 +00:00
|
|
|
],
|
|
|
|
http: {
|
|
|
|
path: `/getClockIn`,
|
2023-11-28 13:48:03 +00:00
|
|
|
verb: 'GET'
|
|
|
|
},
|
|
|
|
returns: {
|
|
|
|
type: ['Object'],
|
|
|
|
root: true
|
|
|
|
},
|
2023-11-23 12:25:31 +00:00
|
|
|
});
|
|
|
|
|
2023-11-28 13:48:03 +00:00
|
|
|
Self.getClockIn = async(workerFk, options) => {
|
2023-11-23 12:25:31 +00:00
|
|
|
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;
|
2023-11-23 12:25:31 +00:00
|
|
|
};
|
|
|
|
};
|