Skip to content

Commit a579a9b

Browse files
committed
Documentation
1 parent e7412b4 commit a579a9b

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,35 @@ In your component:
5858
- `debug` (optional, default: false): Set to true to activate the debug logging.
5959

6060

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+
6190

6291
## Roadmap
6392

@@ -67,7 +96,7 @@ In your component:
6796
- [x] destroy, push & persist
6897
- [ ] Playground project (GraphQL API + Vue/Vuex-ORM app)
6998
- [x] Tests
70-
- [ ] Docs & document schema expectations
99+
- [x] Docs & document schema expectations
71100
- [ ] Subscriptions
72101
- [ ] Attach multiple GraphQL APIs with different models in the same app
73102

0 commit comments

Comments
 (0)