You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -26,6 +26,9 @@ The graphql-sequelize resolver will by default only select those attributes requ
26
26
27
27
If you have non-database values that depend on other values you can either solve this by using virtual attributes with dependencies on your model or disable attribute filtering via `resolver.filterAttributes = false` or for specific resolvers with `resolver(target, {filterAttributes: false})`.
28
28
29
+
#### Default attributes
30
+
When filtering attributes you might need some fields every time, regardless of wether they have been requested in the query. You can specify those fields with the `defaultAttributes` resolver option like `resolver(target, {defaultAttributes: ['default', 'field', 'names']})`. A common use case would be the need to fetch a `userId` for every query and every resource of your domain model for permission checking -- in that case you would write your `resolver` functions like `resolver(target, {defaultAttributes: ['userId']})`.
31
+
29
32
### Features
30
33
31
34
- Automatically converts args to where if arg keys matches model attributes
@@ -38,7 +41,7 @@ If you have non-database values that depend on other values you can either solve
38
41
39
42
[Relay documentation](docs/relay.md)
40
43
41
-
### Examples
44
+
### Examples
42
45
43
46
```js
44
47
import {resolver} from'graphql-sequelize';
@@ -236,7 +239,7 @@ attributeFields(Model);
236
239
### Renaming generated fields
237
240
238
241
attributeFields accepts a ```map``` option to customize the way the attribute fields are named. The ```map``` option accepts
239
-
an object or a function that returns a string.
242
+
an object or a function that returns a string.
240
243
241
244
```js
242
245
@@ -336,12 +339,12 @@ fullName: {
336
339
337
340
### defaultArgs
338
341
339
-
`defaultArgs(Model)` will return an object containing an arg with a key and type matching your models primary key and
342
+
`defaultArgs(Model)` will return an object containing an arg with a key and type matching your models primary key and
340
343
the "where" argument for passing complex query operations described [here](http://docs.sequelizejs.com/en/latest/docs/querying/)
0 commit comments