36 lines
980 B
JavaScript
36 lines
980 B
JavaScript
|
module.exports = Self => {
|
||
|
Self.remoteMethodCtx('collectionFaults', {
|
||
|
description: 'Update sale of a collection',
|
||
|
accessType: 'WRITE',
|
||
|
accepts: [{
|
||
|
arg: 'shelvingFk',
|
||
|
type: 'Number',
|
||
|
required: true,
|
||
|
description: 'The sale id'
|
||
|
}, {
|
||
|
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'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => {
|
||
|
query = `vn.collection_faults(?,?,?)`;
|
||
|
return await Self.rawSql(query, [shelvingFk, quantity, itemFk]);
|
||
|
};
|
||
|
};
|