forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy-tracker-result.js
More file actions
49 lines (47 loc) · 1.73 KB
/
Copy pathmy-tracker-result.js
File metadata and controls
49 lines (47 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { GraphQLBoolean, GraphQLInt, GraphQLObjectType, GraphQLString } from 'graphql'
import { connectionArgs } from 'graphql-relay'
import { organizationSummaryType } from '../../organization/objects/organization-summary'
import { domainOrder } from '../../domain/inputs'
import { domainConnection } from '../../domain/objects'
export const myTrackerType = new GraphQLObjectType({
name: 'MyTrackerResult',
fields: () => ({
summaries: {
type: organizationSummaryType,
description: 'Summaries based on scan types that are preformed on the given organizations domains.',
resolve: ({ summaries }) => summaries,
},
domainCount: {
type: GraphQLInt,
description: 'The number of domains associated with this organization.',
resolve: ({ domainCount }) => domainCount,
},
domains: {
type: domainConnection.connectionType,
description: 'The domains which are associated with this organization.',
args: {
orderBy: {
type: domainOrder,
description: 'Ordering options for domain connections.',
},
ownership: {
type: GraphQLBoolean,
description: 'Limit domains to those that belong to an organization that has ownership.',
},
search: {
type: GraphQLString,
description: 'String used to search for domains.',
},
...connectionArgs,
},
resolve: async ({ _id }, args, { loaders: { loadDomainConnectionsByUserId } }) => {
const connections = await loadDomainConnectionsByUserId({
...args,
myTracker: true,
})
return connections
},
},
}),
description: 'Organization object containing information for a given Organization.',
})