Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT cohort | Route #23

Closed
5 tasks done
rehabas opened this issue Mar 26, 2020 · 0 comments
Closed
5 tasks done

PUT cohort | Route #23

rehabas opened this issue Mar 26, 2020 · 0 comments
Assignees

Comments

@rehabas
Copy link
Collaborator

rehabas commented Mar 26, 2020

relates #5

Route: PUT api/v1/cohorts/:cohortId

Acceptance Criteria

  • Validation schema
  • DB query
  • Request body
  • Response
  • Testing

Validation schema

let addCohort = yup.object({
  name: yup.string().required(),
  description: yup.string().required(),
  imgUrl: yup.string().url().required(),
  githubLink: yup.string().url().required()
});

Request body

req.body = {
            name,
            description,
            imgUrl,
            githubLink
           }

DB query

UPDATE cohort SET (name = req.body.name, description = req.body.description, imgUrl = req.body.imgUrl, githubLink = req.body.githubLink) WHERE id = cohortId;

Response

  • Success
{ StatusCode: 200,
  data: { message: "Cohort updated successfully" }
}
  • Failed
{statusCode:400, message:"Invalid Data"}

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants