Skip to content

Axel's task #2

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

axelzito
Copy link

  1. Postman Queries:
  • Retrieve all courses:

    • Endpoint: http://localhost:3008/courses
    • Query Parameter: None
  • Retrieve unpublished courses:

    • Endpoint:http://localhost:3008/courses
    • Query Parameter: published=false
  • Retrieve published courses:

    • Endpoint: http://localhost:3008/courses
    • Query Parameter: published=true
  1. Postman GraphQL Query:
query {
  collections {
    id
    title
    description
    published
    courses {
      id
      title
      description
      published
    }
  }
}
  1. Check Course Membership:
  • Include collection_id and course_id in the headers:
    • Endpoint: http://localhost:3008/collections/:collection_id/courses/:course_id/belongs_to
  1. Postman GraphQL Query for Collections:
  • Retrieve collections with their associated courses:
    • Endpoint: http://localhost:3008/graphql
    • Query:
  query {
  collections {
    id
    title
    largestDiscountPercentage
    courses {
      id
      title
      published
    }
  }
  1. Postman GraphQL Mutation to Publish a Course:
  • Publish a course by providing the course ID:
    • Endpoint: http://localhost:3008/graphql
    • Mutation:
 mutation {
 publishCourse(input: { courseId: "1" }) {
   id
   published
 }
}

…ublished'. The parameter has been added to the existing route to maintain the simplicity and usability of the API. Tests with Minitest have been kept, but RSpec might suit as a future improvement.
…ated courses. This change involved defining GraphQL types, implementing resolver methods, and creating a query type to efficiently fetch collections and their courses in a single request, optimizing data retrieval. This approach was chosen for its flexibility and ability to prevent over-fetching or under-fetching of data while simplifying associated record fetching.
…'s association with a specific collection, fulfilling the API consumer's requirement. Opted for a RESTful approach to uphold API simplicity. Additionally, retained tests with Minitest, while considering a transition to RSpec for future enhancements, and explored documentation options like Swagger, for instance.
…h collection. As a future improvement, we could link the discounts to courses and choose the largest discount among its courses in the collection.
… The mutation, publishCourse, takes the courseId as input and updates the course's published status. Additionally, retained tests with Minitest, while considering a transition to RSpec for future enhancements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant