boxtribute icon indicating copy to clipboard operation
boxtribute copied to clipboard

GraphQL interface for products pt. 3

Open pylipp opened this issue 10 months ago • 2 comments

Review guide

What's new?

  1. the StandardProduct data model and the corresponding GraphQL type
  2. GraphQL queries to retrieve standard products (either by ID, or a list of them)
  3. GraphQL mutations to enable/edit/disable standard product instantiations for a base
  4. a new resource-based permission standard_product:read (for the view_inventory action-based permission)

Functional review

Only the [email protected] user has the new RBP granted in Auth0.

query { standardProduct(id: 1) { ...on StandardProduct { name version } } }
query { standardProducts { ...on StandardProductPage { elements { name version } } } }

mutation { enableStandardProduct(enableInput: { standardProductId: 1, baseId: 1 }) { ...on Product { id name type price base { id } createdOn } } }
mutation { editStandardProductInstantiation(editInput: { id: X, price: 1 }) { ...on Product { price } } }
mutation { disableStandardProduct(id: X) { ...on Product { deletedOn } } }

Notes/questions

  • the standardProduct* queries return a union type wrapping the actual resource and errors
  • what filters could be useful for standardProducts query? E.g. only the newest version, or filtering for certain versions?
  • should we return an error when editing/deleting deleted products?

Refernces

pylipp avatar Apr 22 '24 16:04 pylipp