forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverified-domain.js
More file actions
56 lines (54 loc) · 1.78 KB
/
verified-domain.js
File metadata and controls
56 lines (54 loc) · 1.78 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
import { GraphQLObjectType } from 'graphql'
import { connectionArgs, globalIdField } from 'graphql-relay'
import { GraphQLDate } from 'graphql-scalars'
import { domainStatus } from '../../domain/objects'
import { Domain } from '../../scalars'
import { verifiedOrganizationOrder } from '../../verified-organizations/inputs'
import { verifiedOrganizationConnection } from '../../verified-organizations/objects'
import { nodeInterface } from '../../node'
export const verifiedDomainType = new GraphQLObjectType({
name: 'VerifiedDomain',
fields: () => ({
id: globalIdField('verifiedDomain'),
domain: {
type: Domain,
description: 'Domain that scans will be ran on.',
resolve: ({ domain }) => domain,
},
lastRan: {
type: GraphQLDate,
description: 'The last time that a scan was ran on this domain.',
resolve: ({ lastRan }) => lastRan,
},
status: {
type: domainStatus,
description: 'The domains scan status, based on the latest scan data.',
resolve: ({ status }) => status,
},
organizations: {
type: verifiedOrganizationConnection.connectionType,
args: {
orderBy: {
type: verifiedOrganizationOrder,
description:
'Ordering options for verified organization connections.',
},
...connectionArgs,
},
description: 'The organization that this domain belongs to.',
resolve: async (
{ _id },
args,
{ loaders: { loadVerifiedOrgConnectionsByDomainId } },
) => {
const orgs = await loadVerifiedOrgConnectionsByDomainId({
domainId: _id,
...args,
})
return orgs
},
},
}),
interfaces: [nodeInterface],
description: 'Domain object containing information for a given domain.',
})