Boss machine project: Problem with creating the work put route in the Bonus section

Hello everyone,

I am currently working on the boss machine project. Here is the link to the project.

I working on the bonus section of the project. I am trying to get the put route to work for /api/minions/:minionId/work

Everything seems to work except for one part. Here is what I get from the test results:

And here is my code for the put route in minions.js:

minionsRouter.put('/:minionId/work/:workId',(req,res,next) => {
  const newWorkData = req.body;
  const workDataWithMinionId = Number(req.body.minionId);
  const workDataWithId = Number(req.body.id);
  const workId = Number(req.params.workId);
  const minionId = Number(req.params.minionId);

  if(!workId){
    res.status(404).send();
  }
  if(workDataWithId !==workId){
    res.status(404).send();
  }
  if(workDataWithMinionId !== minionId){
      res.status(400).send();
  }
  const updatedWorkData = updateInstanceInDatabase('work',newWorkData);
  if(updatedWorkData){
    res.status(200).send(updatedWorkData);
  }
  else{
    res.status(404).send();
  }
});

I tried comparing the req.body.minionId to req.params.minionId and I would send a status of 400 if they are not equal. But that doesn’t seem to satisfy the last test that I can’t pass. Any ideas? Any help is appreciated. Thanks! Happy coding :slight_smile:

I also received this error: