|
1 | | -import { isObject, SchemaComposer } from 'graphql-compose'; |
| 1 | +import { SchemaComposer } from 'graphql-compose'; |
2 | 2 | import { Options } from '../../definitions'; |
3 | 3 |
|
4 | 4 | export function createRepeatOptionsTC(sc: SchemaComposer<any>, opts: Options) { |
5 | 5 | const { typePrefix } = opts; |
6 | 6 |
|
7 | | - const RepeatOptionsInterfaceTC = sc.createInterfaceTC({ |
8 | | - name: `${typePrefix}RepeatOptionsInterface`, |
| 7 | + const RepeatOptionsTC = sc.createObjectTC({ |
| 8 | + name: `${typePrefix}RepeatOptions`, |
9 | 9 | fields: { |
10 | 10 | tz: 'String', |
11 | 11 | endDate: 'Date', |
12 | 12 | limit: 'Int', |
13 | 13 | count: 'Int', |
14 | 14 | prevMillis: 'Int', |
15 | 15 | jobId: 'String', |
16 | | - }, |
17 | | - }); |
18 | | - |
19 | | - const RepeatOptionsCronTC = sc.createObjectTC({ |
20 | | - name: `${typePrefix}RepeatOptionsCron`, |
21 | | - interfaces: [RepeatOptionsInterfaceTC], |
22 | | - fields: { |
23 | | - tz: 'String', |
24 | | - endDate: 'Date', |
25 | | - limit: 'Int', |
26 | 16 | cron: 'String', |
27 | 17 | startDate: 'Date', |
28 | | - count: 'Int', |
29 | | - prevMillis: 'Int', |
30 | | - jobId: 'String', |
31 | | - }, |
32 | | - }); |
33 | | - |
34 | | - const RepeatOptionsEveryTC = sc.createObjectTC({ |
35 | | - name: `${typePrefix}RepeatOptionsEvery`, |
36 | | - interfaces: [RepeatOptionsInterfaceTC], |
37 | | - fields: { |
38 | | - tz: 'String', |
39 | | - endDate: 'Date', |
40 | | - limit: 'Int', |
41 | 18 | every: 'String', |
42 | | - count: 'Int', |
43 | | - prevMillis: 'Int', |
44 | | - jobId: 'String', |
45 | 19 | }, |
46 | 20 | }); |
47 | 21 |
|
48 | | - RepeatOptionsInterfaceTC.addTypeResolver(RepeatOptionsEveryTC, (value) => { |
49 | | - return isObject(value) && value.hasOwnProperty('every'); |
50 | | - }); |
51 | | - |
52 | | - RepeatOptionsInterfaceTC.addTypeResolver(RepeatOptionsCronTC, (value) => { |
53 | | - return isObject(value) && value.hasOwnProperty('cron'); |
54 | | - }); |
55 | | - |
56 | | - return RepeatOptionsInterfaceTC; |
| 22 | + return RepeatOptionsTC; |
57 | 23 | } |
0 commit comments