I find it dirty to access the database in a middleware, ie. I would like
to put all access on the database as close to the resolver as possible.
However, in this case that would mean to put the authorization check in
the resolver, where nobody expects it to be.
CC @appinteractive
CC @Tirokk @grenzfrequence
* the top level block should correspond with the name of the resolver
* the block below should be `CreatePost` or `UpdatePost`
* the arguments of client.request are `query/mutation`, `variables` but
you passed in the `headers` which should go into `new
GraphQlClient(host, options)`
* re-use the very same mutation to avoid bugs in the tests
* use `await expect(someAsyncMethod).resolves.toEqual(expected)` style for
extra test assurance
This was causing a lot of headache on the frontend. Now, there a single
source of truth. If you query `currentUser` you can overwrite your local
copy of the user and update the UI.