salix/modules/worker/back/methods/department/removeChild.js

28 lines
715 B
JavaScript

module.exports = Self => {
Self.remoteMethod('removeChild', {
description: 'Returns the first shipped and landed possible for params',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'Number',
description: 'The department id',
http: {source: 'path'}
}],
returns: {
type: 'Object',
root: true
},
http: {
path: `/:id/removeChild`,
verb: 'POST'
}
});
Self.removeChild = async id => {
const models = Self.app.models;
const department = await models.Department.findById(id);
return await department.destroy();
};
};