@@ -58,6 +58,35 @@ In your component:
58
58
- ` debug ` (optional, default: false): Set to true to activate the debug logging.
59
59
60
60
61
+ ## API
62
+
63
+ While using Vuex-ORM you have to distinct between two types of operations:
64
+
65
+ - Vuex operations: Retrieve or save data from or to Vuex
66
+ - Persistence operations: Load or persist data from Vuex to the GraphQL API
67
+
68
+ The following table lists all operations you can use and what they to:
69
+
70
+ CRUD | Vuex Only | Persist to GraphQL API
71
+ --| -- | --
72
+ ** R** EAD | getters[ 'find'] & getters[ 'findAll'] | dispatch('fetch')
73
+ ** C** REATE | dispatch('create) | dispatch('persist')
74
+ ** U** PDATE | dispatch('save') | dispatch('push')
75
+ ** D** ELETE | dispatch('delete') | dispatch('destroy')
76
+
77
+
78
+ ## Schema expectations
79
+
80
+ This plugin has an opinion how the GraphQL API schema should look like:
81
+
82
+ - Query for multiple records is plural camelCase: ` blogPosts `
83
+ - Mutations begin with the verb (` create ` , ` update ` , ` delete ` ) and the camelCased entity: ` createBlogPost ` for example.
84
+ - The create mutation expects the new record as argument
85
+ - The update mutation expects two arguments: The ID and the new record
86
+ - The delete mutation expects the record ID to delete
87
+
88
+ You can see query examples in the [ project wiki] ( ) .
89
+
61
90
62
91
## Roadmap
63
92
@@ -67,7 +96,7 @@ In your component:
67
96
- [x] destroy, push & persist
68
97
- [ ] Playground project (GraphQL API + Vue/Vuex-ORM app)
69
98
- [x] Tests
70
- - [ ] Docs & document schema expectations
99
+ - [x ] Docs & document schema expectations
71
100
- [ ] Subscriptions
72
101
- [ ] Attach multiple GraphQL APIs with different models in the same app
73
102
0 commit comments