forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverified-organization.js
More file actions
101 lines (99 loc) · 3.06 KB
/
verified-organization.js
File metadata and controls
101 lines (99 loc) · 3.06 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import {
GraphQLBoolean,
GraphQLInt,
GraphQLObjectType,
GraphQLString,
} from 'graphql'
import { connectionArgs, globalIdField } from 'graphql-relay'
import { verifiedDomainOrder } from '../../verified-domains/inputs'
import { verifiedDomainConnection } from '../../verified-domains/objects'
import { organizationSummaryType } from '../../organization/objects'
import { Acronym, Slug } from '../../scalars'
import { nodeInterface } from '../../node'
export const verifiedOrganizationType = new GraphQLObjectType({
name: 'VerifiedOrganization',
fields: () => ({
id: globalIdField('verifiedOrganization'),
acronym: {
type: Acronym,
description: 'The organizations acronym.',
resolve: ({ acronym }) => acronym,
},
name: {
type: GraphQLString,
description: 'The full name of the organization.',
resolve: ({ name }) => name,
},
slug: {
type: Slug,
description: 'Slugified name of the organization.',
resolve: ({ slug }) => slug,
},
zone: {
type: GraphQLString,
description: 'The zone which the organization belongs to.',
resolve: ({ zone }) => zone,
},
sector: {
type: GraphQLString,
description: 'The sector which the organization belongs to.',
resolve: ({ sector }) => sector,
},
country: {
type: GraphQLString,
description: 'The country in which the organization resides.',
resolve: ({ country }) => country,
},
province: {
type: GraphQLString,
description: 'The province in which the organization resides.',
resolve: ({ province }) => province,
},
city: {
type: GraphQLString,
description: 'The city in which the organization resides.',
resolve: ({ city }) => city,
},
verified: {
type: GraphQLBoolean,
description: 'Whether the organization is a verified organization.',
resolve: ({ verified }) => verified,
},
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: verifiedDomainConnection.connectionType,
description: 'The domains which are associated with this organization.',
args: {
orderBy: {
type: verifiedDomainOrder,
description: 'Ordering options for verified domain connections.',
},
...connectionArgs,
},
resolve: async (
{ _id },
args,
{ loaders: { loadVerifiedDomainConnectionsByOrgId } },
) => {
const domains = await loadVerifiedDomainConnectionsByOrgId({
orgId: _id,
...args,
})
return domains
},
},
}),
interfaces: [nodeInterface],
description:
'Verified Organization object containing information for a given Organization.',
})