server/api/assignments/assignments.controller.js
/**
 * Given an assignment ID, remove the assignment only if it belongs to the logged in user.
 * The assignment should be in the params of the request.
 *
 * POST /assignments/a/:assignmentID/remove
 * @param {Koa context} ctx
 * @returns The removed assignment.
 */
Given an assignment ID, remove the assignment only if it belongs to the logged in user.
The assignment should be in the params of the request.

POST /assignments/a/:assignmentID/remove
@param {Koa context} ctx
@returns The removed assignment.
Given an assignment ID remove the assignment only if it belongs to the logged in user . The assignment should be in the params of the request . POST / assignments / a / : assignmentID / remove @param { Koa context } ctx @returns The removed assignment .
async function removeAssignment (ctx) {
  const assignmentID = ctx.params.assignmentID;
  try {
    ctx.state.assignment.remove();
  } catch (e) {
    logger.error(`Failed to remove assignment with ID ${assignmentID}: ${e}`);
    return ctx.internalServerError(
      'There was an error removing the assignment.'
    );
  }
  logger.info(
    `Removed assignment ${ctx.state.assignment._id} for ${
      ctx.state.user.rcs_id
    }`
  );
  ctx.ok({
    removedAssignment: ctx.state.assignment
  });
}
async function removeAssignment ( ctx ) { const assignmentID = ctx . params . assignmentID ; try { ctx . state . assignment . remove ( ) ; } catch ( e ) { logger . error ( ` ${ assignmentID } ${ e } ` ) ; return ctx . internalServerError ( 'There was an error removing the assignment.' ) ; } logger . info ( ` ${ ctx . state . assignment . _id } ${ ctx . state . user . rcs_id } ` ) ; ctx . ok ( { removedAssignment : ctx . state . assignment } ) ; }
Given an assignment ID, remove the assignment only if it belongs to the logged in user.
Given an assignment ID remove the assignment only if it belongs to the logged in user .
// Remove assignment