2020-03-23 12:26:45 +00:00
|
|
|
module.exports = Self => {
|
2020-03-26 12:12:59 +00:00
|
|
|
Self.remoteMethod('collectionFaults', {
|
2020-03-23 12:26:45 +00:00
|
|
|
description: 'Update sale of a collection',
|
|
|
|
accessType: 'WRITE',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'shelvingFk',
|
2020-03-23 14:22:48 +00:00
|
|
|
type: 'String',
|
2020-03-23 12:26:45 +00:00
|
|
|
required: true,
|
2020-03-23 14:22:48 +00:00
|
|
|
description: 'The shalving id'
|
2020-03-23 12:26:45 +00:00
|
|
|
}, {
|
|
|
|
arg: 'quantity',
|
|
|
|
type: 'Number',
|
|
|
|
required: true,
|
|
|
|
description: 'The quantity to sale'
|
|
|
|
}, {
|
|
|
|
arg: 'itemFk',
|
|
|
|
type: 'Number',
|
|
|
|
required: true,
|
|
|
|
description: 'The ticket id'
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
type: 'Object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/collectionFaults`,
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-26 12:12:59 +00:00
|
|
|
Self.collectionFaults = async(shelvingFk, quantity, itemFk) => {
|
2020-03-23 14:22:48 +00:00
|
|
|
query = `CALL vn.collection_faults(?,?,?)`;
|
2020-03-23 12:26:45 +00:00
|
|
|
return await Self.rawSql(query, [shelvingFk, quantity, itemFk]);
|
|
|
|
};
|
|
|
|
};
|