Closed mattstein closed 3 years ago
Thanks so much for starting this @mattstein - amazing work! I'll review everything shortly.
Sure thing @engram-design, just sneaking this draft PR in now that I’ve got a good start.
I noted quick examples of what’s working right now, but validation and schema components need fine-tuning to account for the plugin settings and user-limited actions. Still thinking through those a bit, but happy to talk through this at any point!
Finally have this to a place that’s worth reviewing, @engram-design! Some interfaces may need adjustment (commentId
instead of id
, etc.), but I fleshed out the PR description for a better summary of what’s going on here.
Nice work - I've been following along! I'll dive into review in the coming days.
Thanks again for your work on this!
Description
This PR-in-progress adds mutation support to approximate front-end controller actions via the GraphQL API.
There’s some architectural gray area—at least for me—since GraphQL includes a concept of customizable schemas and tokens, where a Craft User session may or may not be relevant or available depending on how the plugin is used. It seems like it’s best to support plugin settings wherever possible rather than duplicating them, keeping the schema components simple.
Comments are saved using
SCENARIO_LIVE
, mimicking Craft’s own elements+GraphQL. It seems like this scenario was previously unused and safe to set up exclusively for use via GraphQL.This randomly adds a
comment
query for getting a single comment in addition to the existingcomments
one—mostly for fun and to follow the pattern used by first-party element types.Features
GraphQL features to be supported and tested.
saveComment
saveComment
with IDvoteComment
flagComment
subscribeComment
deleteComment
Validation
Exhaustive list of settings to check against. (Some may already be supported and just need testing.)