Skip to content

Commit bf41c76

Browse files
authored
Ordering Verified Domains (canada-ca#1683)
* create verified domain ordering enum * create verified domain orderBy input object * add ordering functionality to verified domain connection loaders * add ordering arguments to queries and objects
1 parent 40c181b commit bf41c76

11 files changed

Lines changed: 1856 additions & 31 deletions

api-js/src/enums/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export * from './scan-types'
1313
export * from './ssl-order-field'
1414
export * from './status'
1515
export * from './tfa-send-method'
16+
export * from './verified-domain-order-field'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { GraphQLEnumType } from 'graphql'
2+
3+
export const VerifiedDomainOrderField = new GraphQLEnumType({
4+
name: 'VerifiedDomainOrderField',
5+
description:
6+
'Properties by which verified domain connections can be ordered.',
7+
values: {
8+
DOMAIN: {
9+
value: 'domain',
10+
description: 'Order verified domain edges by domain.',
11+
},
12+
LAST_RAN: {
13+
value: 'last-ran',
14+
description: 'Order verified domain edges by last ran.',
15+
},
16+
DKIM_STATUS: {
17+
value: 'dkim-status',
18+
description: 'Order verified domain edges by dkim status.',
19+
},
20+
DMARC_STATUS: {
21+
value: 'dmarc-status',
22+
description: 'Order verified domain edges by dmarc status.',
23+
},
24+
HTTPS_STATUS: {
25+
value: 'https-status',
26+
description: 'Order verified domain edges by https status.',
27+
},
28+
SPF_STATUS: {
29+
value: 'spf-status',
30+
description: 'Order verified domain edges by spf status.',
31+
},
32+
SSL_STATUS: {
33+
value: 'ssl-status',
34+
description: 'Order verified domain edges by ssl status.',
35+
},
36+
},
37+
})
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { GraphQLNonNull } from 'graphql'
2+
3+
import { verifiedDomainOrder } from '../verified-domain-order'
4+
import { OrderDirection, VerifiedDomainOrderField } from '../../../enums'
5+
6+
describe('given the verifiedDomainOrder input object', () => {
7+
describe('testing fields', () => {
8+
it('has a direction field', () => {
9+
const demoType = verifiedDomainOrder.getFields()
10+
11+
expect(demoType).toHaveProperty('direction')
12+
expect(demoType.direction.type).toMatchObject(
13+
GraphQLNonNull(OrderDirection),
14+
)
15+
})
16+
it('has a field field', () => {
17+
const demoType = verifiedDomainOrder.getFields()
18+
19+
expect(demoType).toHaveProperty('field')
20+
expect(demoType.field.type).toMatchObject(
21+
GraphQLNonNull(VerifiedDomainOrderField),
22+
)
23+
})
24+
})
25+
})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './verified-domain-order'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'
2+
3+
import { OrderDirection, VerifiedDomainOrderField } from '../../enums'
4+
5+
export const verifiedDomainOrder = new GraphQLInputObjectType({
6+
name: 'VerifiedDomainOrder',
7+
description: 'Ordering options for verified domain connections.',
8+
fields: () => ({
9+
field: {
10+
type: GraphQLNonNull(VerifiedDomainOrderField),
11+
description: 'The field to order verified domains by.',
12+
},
13+
direction: {
14+
type: GraphQLNonNull(OrderDirection),
15+
description: 'The ordering direction.',
16+
},
17+
}),
18+
})

0 commit comments

Comments
 (0)