2023-12-13 10:43:19 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('delete', {
|
|
|
|
description: 'Delete an ItemBarcode by itemFk and code',
|
2024-03-04 08:21:41 +00:00
|
|
|
accessType: 'WRITE',
|
2023-12-13 10:43:19 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
};
|