35 lines
809 B
JavaScript
35 lines
809 B
JavaScript
|
module.exports = Self => {
|
||
|
Self.remoteMethod('delete', {
|
||
|
description: 'Delete an ItemBarcode by itemFk and code',
|
||
|
accessType: 'WRITE',
|
||
|
accepts: [
|
||
|
{
|
||
|
arg: 'barcode',
|
||
|
type: 'string',
|
||
|
required: true,
|
||
|
},
|
||
|
{
|
||
|
arg: 'itemFk',
|
||
|
type: 'number',
|
||
|
required: true,
|
||
|
}
|
||
|
],
|
||
|
http: {
|
||
|
path: `/delete`,
|
||
|
verb: 'DELETE'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Self.delete = async(barcode, itemFk, options) => {
|
||
|
const myOptions = {};
|
||
|
|
||
|
if (typeof options == 'object')
|
||
|
Object.assign(myOptions, options);
|
||
|
|
||
|
await Self.destroyAll({
|
||
|
code: barcode,
|
||
|
itemFk
|
||
|
}, myOptions);
|
||
|
};
|
||
|
};
|