apps/manage-a-book-trading-club/app/controllers/requestsController.js
/*
 *   - remove request
 *   - pull request from all request.takes Book.requests
 *   - pull request from all receiver's User.receivedRequests
 */
- remove request
- pull request from all request.takes Book.requests
- pull request from all receiver's User.receivedRequests
- remove request - pull request from all request . takes Book . requests - pull request from all receiver ' s User . receivedRequests
function deleteRequest(request) {
  return request.remove()
    .then(() => Book.update(
        { requests: request._id },
        { $pull: { requests: request._id } },
        { multi: true }))
    .then(() => User.update(
        { receivedRequests: request._id },
        { $pull: { receivedRequests: request._id } },
        { multi: true }));
}
function deleteRequest ( request ) { return request . remove ( ) . then ( ( ) => Book . update ( { requests : request . _id } , { $pull : { requests : request . _id } } , { multi : true } ) ) . then ( ( ) => User . update ( { receivedRequests : request . _id } , { $pull : { receivedRequests : request . _id } } , { multi : true } ) ) ; }
- remove request
   - pull request from all request.takes Book.requests
   - pull request from all receiver's User.receivedRequests
- remove request - pull request from all request . takes Book . requests - pull request from all receiver ' s User . receivedRequests