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

feat: 4106 nnnnat catalogItem GQL query #4200

Merged
merged 11 commits into from
Apr 23, 2018

Conversation

nnnnat
Copy link
Contributor

@nnnnat nnnnat commented Apr 18, 2018

Resolves #4106
Impact: minor
Type: feature

Issue

Summary
Create a query to retrieve a single catalog product by the provided slug or ID.

Implementation
The catalogProduct query should have the following signature

catalogProduct(slugOrId: String): CatalogItemProduct

See #4105 for schema detail.

Acceptance Criteria
Using GraphQL, I can use the catalogProduct(slugOrId: String): CatalogItemProduct query to get a single CatalogProduct by it's slug.

Solution

  • Created a Catalog Collection Query that returns the product from the catalog collection
  • Created a catalogItemProduct GQL query that returns a CatalogItemProduct object
  • Created unit test for both of the new query functions
  • Created integration test for the CatalogItemProduct GQL query.

Breaking changes

N/A

Testing

  1. Spin up a fresh RC shop, login as an admin and create a few products and publish them to the catalog.
  2. From graphiql or localhost:3030/graphiql query a product by slug with catalogItemProduct(slugOrId: "example-product") { _id } and copy the returned ID
  3. Try the query again this time with the ID instead of the slug catalogItemProduct(slugOrId: "opaqueID") { _id product { slug } }
  4. The same product should return.

@nnnnat nnnnat self-assigned this Apr 20, 2018
@nnnnat nnnnat changed the base branch from feat-4105-aldeed-gql-catalog-items to release-1.12.0 April 20, 2018 16:14
@nnnnat nnnnat requested a review from aldeed April 20, 2018 22:44
@nnnnat nnnnat changed the title [WIP] feat: 4106 nnnnat catalogItem GQL query feat: 4106 nnnnat catalogItem GQL query Apr 20, 2018
Copy link
Contributor

@aldeed aldeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See one little comment and delete the yarn.lock file since this repo does not use yarn

@@ -391,4 +391,9 @@ extend type Query {
"By default, items are sorted by when they were created, newest first. Set this to sort by one of the other allowed fields"
sortBy: CatalogItemSortByField = createdAt
): CatalogItemConnection
"Gets product from catalog"
catalogItemProduct(
"Provide either a product id or slug"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id -> ID since this is end-user documentation

@nnnnat
Copy link
Contributor Author

nnnnat commented Apr 23, 2018

@aldeed I've removed the yarn.lock and updated the catalogItemProduct query comments

@aldeed aldeed merged commit d88cdcc into release-1.12.0 Apr 23, 2018
@aldeed aldeed deleted the feat-4106-nnnnat-gql-catalog-product branch April 23, 2018 18:43
@spencern spencern mentioned this pull request May 31, 2018
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.

2 participants