module.exports = Self => { Self.remoteMethod('getClockIn', { description: 'Shows the clockings for each day, in columns per day', accessType: 'READ', accepts: [ { arg: 'workerFk', type: 'int', required: true, }, ], http: { path: `/getClockIn`, verb: 'GET' }, returns: { type: ['Object'], root: true }, }); Self.getClockIn = async(workerFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); const query = `CALL vn.workerTimeControl_getClockIn(?, CURDATE())`; const [result] = await Self.rawSql(query, [workerFk], myOptions); return result; }; };