35 lines
808 B
JavaScript
35 lines
808 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('delete', {
|
|
description: 'Delete an ItemBarcode by itemFk and code',
|
|
accessType: 'READ',
|
|
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);
|
|
};
|
|
};
|