Skip to content

Commit

Permalink
feat: project update cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrastopoulos committed Feb 6, 2025
1 parent 4a9148c commit 9f77d70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/controllers/ProjectsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export const editProject = async (
return bad(res, "Project already submitted");
}

await Project.updateOne(
{ _id: id },
await Project.findByIdAndUpdate(
id,
{ $set: req.body },
{ new: true },
function (err, result) {
Expand All @@ -136,7 +136,7 @@ export const editProject = async (
);
} catch (err) {
if (err.name === "CastError" || err.name === "ValidationError") {
return bad(res);
return bad(res, err.message);
} else {
console.error(err);
return error(res);
Expand Down

0 comments on commit 9f77d70

Please sign in to comment.