module.exports = Self => { Self.remoteMethod('deleteItemShelvings', { description: 'Deletes the selected orders', accessType: 'WRITE', accepts: [{ arg: 'itemShelvingIds', type: ['number'], required: true, description: 'The itemShelving ids to delete' }], returns: { type: ['object'], root: true }, http: { path: `/deleteItemShelvings`, verb: 'POST' } }); Self.deleteItemShelvings = async(itemShelvingIds, options) => { const models = Self.app.models; const myOptions = {}; let tx; if (typeof options == 'object') Object.assign(myOptions, options); if (!myOptions.transaction) { tx = await Self.beginTransaction({}); myOptions.transaction = tx; } try { const deletedItemShelvings = await models.ItemShelving.destroyAll({ id: {inq: itemShelvingIds} }, myOptions); if (tx) await tx.commit(); return deletedItemShelvings; } catch (e) { if (tx) await tx.rollback(); throw e; } }; };