Skip to content

Commit 294cc6b

Browse files
committed
docs: improve readme file
1 parent 0be0072 commit 294cc6b

File tree

3 files changed

+459
-1
lines changed

3 files changed

+459
-1
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,75 @@
88

99
This is a plugin for [graphql-compose](https://github.com/graphql-compose/graphql-compose), which generates GraphQLTypes for [bullmq](https://github.com/taskforcesh/bullmq).
1010

11+
## Installation
12+
13+
```bash
14+
npm install graphql graphql-compose bullmq graphql-compose-bullmq --save
15+
```
16+
17+
Modules `graphql`, `graphql-compose`, `bullmq` are in `peerDependencies`, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.
18+
19+
## Example
20+
21+
```js
22+
import { composeBull } from 'graphql-compose-bullmq';
23+
import { schemaComposer } from 'graphql-compose';
24+
25+
const { queryFields, mutationFields } = composeBull({
26+
schemaComposer,
27+
typePrefix: 'Prefix',
28+
jobDataTC: `type MyJobData { fieldA: String! fieldB: String}`,
29+
queue: {
30+
name: 'fetch_metrics',
31+
prefix: 'bull.demo',
32+
},
33+
redis: 'redis://127.0.0.1:6379',
34+
});
35+
36+
schemaComposer.Query.addFields({
37+
...queryFields,
38+
// Will provide the following fields:
39+
// queueKeys
40+
// queues
41+
// queue
42+
// job
43+
});
44+
45+
schemaComposer.Mutation.addFields({
46+
...mutationFields,
47+
// Will provide the following fields:
48+
// queueClean
49+
// queueDrain
50+
// queuePause
51+
// queueResume
52+
// queueRemoveRepeatable
53+
// jobAdd
54+
// jobAddBulk
55+
// jobAddRepeatableCron
56+
// jobAddRepeatableEvery
57+
// jobDiscard
58+
// jobPromote
59+
// jobRemove
60+
// jobRetry
61+
// jobUpdate
62+
// jobLogAdd
63+
});
64+
65+
const schema = schemaComposer.buildSchema();
66+
```
67+
68+
## Schema
69+
70+
`composeBull` will generate particles for your further schema. It contains more than 40 types wich helps to you work with Bull Queues. You may see generated files in [schema.graphql](./example/schema.graphql) file. It can be visialized with <https://apis.guru/graphql-voyager/> in the following manner:
71+
72+
### Queries
73+
74+
<img width="1323" alt="Screen Shot 2020-04-14 at 21 22 38" src="https://user-images.githubusercontent.com/1946920/79242603-5ab18900-7e96-11ea-8aad-7aff95e285ba.png">
75+
76+
### Mutations
77+
78+
<img width="1327" alt="Screen Shot 2020-04-14 at 21 24 05" src="https://user-images.githubusercontent.com/1946920/79242633-61d89700-7e96-11ea-9efc-3afadc3e082c.png">
79+
1180
## License
1281

1382
[MIT](https://github.com/graphql-compose/graphql-compose-bullmq/blob/master/LICENSE.md)

0 commit comments

Comments
 (0)