2022-12-20 14:19:05 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethodCtx('salePreparingList', {
|
|
|
|
description: 'Returns a list with the lines of a ticket and its different states of preparation',
|
|
|
|
accessType: 'READ',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'id',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
description: 'The ticket id',
|
|
|
|
http: {source: 'path'}
|
|
|
|
}],
|
|
|
|
returns: {
|
2022-12-21 14:03:41 +00:00
|
|
|
type: ['object'],
|
2022-12-20 14:19:05 +00:00
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/:id/salePreparingList`,
|
|
|
|
verb: 'GET'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.salePreparingList = async(ctx, id, options) => {
|
|
|
|
const myOptions = {};
|
|
|
|
|
|
|
|
if (typeof options == 'object')
|
|
|
|
Object.assign(myOptions, options);
|
|
|
|
|
|
|
|
query = `CALL vn.salePreparingList(?)`;
|
|
|
|
const [sales] = await Self.rawSql(query, [id], myOptions);
|
|
|
|
|
|
|
|
return sales;
|
|
|
|
};
|
|
|
|
};
|