Skip to content

Commit

Permalink
chore: fallback to creating a developer if it doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ijemmao committed May 5, 2024
1 parent 4c06d25 commit c9ef97f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/developers/index.ts
Expand Up @@ -115,6 +115,11 @@ export const putDeveloper: MiddleWare = async (req, res, next) => {
try {
return res.send(await putDeveloperHelper({ query: { _id: id }, data: req.body }));
} catch (err) {
// TODO: write test to make sure that when there's no developer, the postDeveloper method
// gets called
if (err?.message === 'No developer to update') {
return postDeveloper(req, res, next);
}
return next(err);
}
};
Expand Down

0 comments on commit c9ef97f

Please sign in to comment.