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

2 participants
@nnnnat
Copy link
Member

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.
    • Note: if you use the reaction devtools to speed products you'll need to update your RC shop name to be "reaction swag shop" or you'll get an error from reaction. You may need to change the shop name from the DB because of this (#4202) issue.
  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 Apr 20, 2018

nnnnat added some commits Apr 20, 2018

test: added inegration test for catalogItemProduct query, updated cat…
…alog.gql with catalogItemProduct comments

@nnnnat nnnnat requested a review from aldeed Apr 20, 2018

@nnnnat nnnnat changed the title [WIP] feat: 4106 nnnnat catalogItem GQL query feat: 4106 nnnnat catalogItem GQL query Apr 20, 2018

@aldeed
Copy link
Member

aldeed left a comment

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"

This comment has been minimized.

Copy link
@aldeed

aldeed Apr 23, 2018

Member

id -> ID since this is end-user documentation

nnnnat added some commits Apr 23, 2018

@nnnnat

This comment has been minimized.

Copy link
Member Author

nnnnat commented Apr 23, 2018

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

@aldeed

aldeed approved these changes Apr 23, 2018

@aldeed aldeed merged commit d88cdcc into release-1.12.0 Apr 23, 2018

10 checks passed

WIP ready for review
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: docker-build Your tests passed on CircleCI!
Details
ci/circleci: docker-push Your tests passed on CircleCI!
Details
ci/circleci: dockerfile-lint Your tests passed on CircleCI!
Details
ci/circleci: eslint Your tests passed on CircleCI!
Details
ci/circleci: snyk-security Your tests passed on CircleCI!
Details
ci/circleci: test-app Your tests passed on CircleCI!
Details
ci/circleci: test-unit Your tests passed on CircleCI!
Details
security/snyk No new issues
Details

@aldeed aldeed deleted the feat-4106-nnnnat-gql-catalog-product branch Apr 23, 2018

@spencern spencern referenced this pull request May 31, 2018

Merged

Release 1.12.0 #4287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.