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

28 lines
715 B
JavaScript
Raw Normal View History

2019-10-04 05:41:24 +00:00
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();
};
};