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

POST cohort | Route #21

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

POST cohort | Route #21

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

Comments

@rehabas
Copy link
Collaborator

rehabas commented Mar 26, 2020

relates #5

Route: POST api/v1/cohorts

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

INSERT INTO cohort (name, description, imgUrl, githubLink) VALUES (req.body.name, req.body.description, req.body.imgUrl, req.body.githubLink);

Response

  • Success
{ StatusCode: 201,
  data: { cohort: rows[0], message: "Cohort added successfully" }
}
  • Failed
{statusCode:400, message:"Cohort already exists"}

Testing

to be a successful test

  • status === 201
  • typeof(data) === "object"
@rehabas rehabas changed the title Add new cohort | Route POST cohort | Route Mar 26, 2020
@rehabas rehabas added in progress and removed To-Do labels Mar 29, 2020
rehabas added a commit that referenced this issue Mar 30, 2020
@rehabas rehabas mentioned this issue Mar 30, 2020
rehabas added a commit that referenced this issue Mar 30, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
relates #21
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Mar 31, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 1, 2020
rehabas added a commit that referenced this issue Apr 2, 2020
@rehabas rehabas added the Awaiting Review This PR is ready and waiting for review label Apr 2, 2020
rehabas added a commit that referenced this issue Apr 2, 2020
@ranasobeid95 ranasobeid95 added Done and removed Awaiting Review This PR is ready and waiting for review labels Apr 2, 2020
rehabas added a commit that referenced this issue Apr 3, 2020
rehabas added a commit that referenced this issue Apr 3, 2020
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

2 participants