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 /projects | Route #24

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

POST /projects | Route #24

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

Comments

@MohammedAlghazali
Copy link
Member

MohammedAlghazali commented Mar 26, 2020

relates #5

Route: POST api/v1/projects

Acceptance Criteria

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

Validation schema

let addProject = yup.object({
  name: yup.string().required(),
  description: yup.string().required(),
  imgUrl: yup.string().url().required(),
  githubLink: yup.string().url().required(),
  websiteLink: yup.string().url().required(),
  projectType: yup.string().required(),
  cohortId: yup.number().integer().positive().required(),
});

Request body

req.body = {
            name,
            description,
            imgUrl,
            githubLink,
            websiteLink,
            projectType,
            cohortId,
           }

DB query

INSERT INTO project (name, description, imgUrl, githubLink, websiteLink, projectType, cohortId) VALUES (req.body.name, req.body.description, req.body.imgUrl, req.body.githubLink, req.body.websiteLink, req.body.projectType, req.body.cohortId);

Response

  • Success
{ StatusCode: 201,
  data: {projectId,message: "Project Added Successfully}
}
  • Failed
{statusCode:400, message:"Invalid Data"}

Testing

to be a successful test

  • status === 201
  • typeof(data) === "object"
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 30, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Mar 31, 2020
MohammedAlghazali added a commit that referenced this issue Apr 1, 2020
MohammedAlghazali added a commit that referenced this issue Apr 1, 2020
MohammedAlghazali added a commit that referenced this issue Apr 1, 2020
MohammedAlghazali added a commit that referenced this issue Apr 2, 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

1 participant