Skip to content

Commit

Permalink
Edit destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Mu7ammadAbed committed Apr 1, 2020
1 parent 98d40d0 commit ff5e871
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/controllers/routes/admin/cohort/editCohort.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ const { editCohortSchema } = require('../../../../validation/index');
const editCohort = async (req, res, next) => {
try {
const { cohortId } = req.params;
const data = { ...req.body, cohortId };
await editCohortSchema.validate(data, { abortEarly: false });
const data = await editCohortSchema.validate(
{ ...req.body, cohortId },
{
abortEarly: false,
},
);
const result = await putSpecificCohort(data);
if (result.rowCount === 1) {
res.json({ statusCode: 200, message: 'Changed Succefully' });
Expand Down

0 comments on commit ff5e871

Please sign in to comment.