38 lines
1019 B
JavaScript
38 lines
1019 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethodCtx('getBuyUltimate', {
|
|
description: 'Returns the last buy of the item',
|
|
accessType: 'READ',
|
|
accepts: [
|
|
{
|
|
arg: 'itemFk',
|
|
type: 'number',
|
|
required: true
|
|
}, {
|
|
arg: 'warehouseFk',
|
|
type: 'number',
|
|
required: true
|
|
}, {
|
|
arg: 'date',
|
|
type: 'date',
|
|
required: true
|
|
}
|
|
],
|
|
returns: {
|
|
type: 'object',
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/getBuyUltimate`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
Self.getBuyUltimate = async(ctx, itemFk, warehouseFk, date, options) => {
|
|
const myOptions = {};
|
|
|
|
if (typeof options == 'object')
|
|
Object.assign(myOptions, options);
|
|
|
|
return Self.rawSql('CALL vn.buy_getUltimate(?, ?, ?)', [itemFk, warehouseFk, date], myOptions);
|
|
};
|
|
};
|