salix/modules/item/back/methods/item-barcode/delete.js

35 lines
809 B
JavaScript
Raw Permalink Normal View History

2024-03-14 07:36:19 +00:00
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);
};
};