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(); }; };