Skip to content

Commit 136ecc1

Browse files
authored
Ordering Guidance Tags (canada-ca#1698)
* create guidance tag ordering enum * create guidance tag ordering input object * add ordering for dkim connection loader * add ordering for dmarc connection loader * add ordering for https connection loader * add ordering for spf connection loader * add ordering for ssl connection loader * add guidance tag ordering args to guidance tag connection fields
1 parent fe7bf7e commit 136ecc1

21 files changed

Lines changed: 2201 additions & 55 deletions

api-js/src/email-scan/objects/dkim-result.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { GraphQLJSON } from 'graphql-scalars'
88

99
import { dkimType } from './dkim'
1010
import { nodeInterface } from '../../node'
11-
import { guidanceTagConnection } from '../../guidance-tag'
11+
import { guidanceTagOrder } from '../../guidance-tag/inputs'
12+
import { guidanceTagConnection } from '../../guidance-tag/objects'
1213

1314
export const dkimResultType = new GraphQLObjectType({
1415
name: 'DKIMResult',
@@ -47,6 +48,10 @@ export const dkimResultType = new GraphQLObjectType({
4748
guidanceTags: {
4849
type: guidanceTagConnection.connectionType,
4950
args: {
51+
orderBy: {
52+
type: guidanceTagOrder,
53+
description: 'Ordering options for guidance tag connections',
54+
},
5055
...connectionArgs,
5156
},
5257
description: 'Key tags found during scan.',

api-js/src/email-scan/objects/dmarc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { GraphQLJSON } from 'graphql-scalars'
88

99
import { domainType } from '../../domain/objects'
1010
import { nodeInterface } from '../../node'
11-
import { guidanceTagConnection } from '../../guidance-tag'
11+
import { guidanceTagOrder } from '../../guidance-tag/inputs'
12+
import { guidanceTagConnection } from '../../guidance-tag/objects'
1213

1314
export const dmarcType = new GraphQLObjectType({
1415
name: 'DMARC',
@@ -59,6 +60,10 @@ subdomains where mail is failing the DMARC authentication and alignment checks.`
5960
guidanceTags: {
6061
type: guidanceTagConnection.connectionType,
6162
args: {
63+
orderBy: {
64+
type: guidanceTagOrder,
65+
description: 'Ordering options for guidance tag connections',
66+
},
6267
...connectionArgs,
6368
},
6469
description: `Key tags found during DMARC Scan.`,

api-js/src/email-scan/objects/spf.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { GraphQLJSON } from 'graphql-scalars'
88

99
import { domainType } from '../../domain/objects'
1010
import { nodeInterface } from '../../node'
11-
import { guidanceTagConnection } from '../../guidance-tag'
11+
import { guidanceTagOrder } from '../../guidance-tag/inputs'
12+
import { guidanceTagConnection } from '../../guidance-tag/objects'
1213

1314
export const spfType = new GraphQLObjectType({
1415
name: 'SPF',
@@ -52,6 +53,10 @@ export const spfType = new GraphQLObjectType({
5253
guidanceTags: {
5354
type: guidanceTagConnection.connectionType,
5455
args: {
56+
orderBy: {
57+
type: guidanceTagOrder,
58+
description: 'Ordering options for guidance tag connections',
59+
},
5560
...connectionArgs,
5661
},
5762
description: `Key tags found during scan.`,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { GraphQLEnumType } from 'graphql'
2+
3+
export const GuidanceTagOrderField = new GraphQLEnumType({
4+
name: 'GuidanceTagOrderField',
5+
description: 'Properties by which Guidance Tag connections can be ordered.',
6+
values: {
7+
TAG_ID: {
8+
value: 'tag-id',
9+
description: 'Order guidance tag edges by tag id.',
10+
},
11+
TAG_NAME: {
12+
value: 'tag-name',
13+
description: 'Order guidance tag edges by tag name.',
14+
},
15+
GUIDANCE: {
16+
value: 'guidance',
17+
description: 'Order guidance tag edges by tag guidance.',
18+
},
19+
},
20+
})

api-js/src/enums/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from './dkim-result-order-field'
33
export * from './dmarc-order-field'
44
export * from './dmarc-summary-order-field'
55
export * from './domain-order-field'
6+
export * from './guidance-tag-order-field'
67
export * from './https-order-field'
78
export * from './languages'
89
export * from './order-direction'

api-js/src/guidance-tag/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from './inputs'
12
export * from './loaders'
23
export * from './objects'
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 { guidanceTagOrder } from '../guidance-tag-order'
4+
import { OrderDirection, GuidanceTagOrderField } from '../../../enums'
5+
6+
describe('given the guidanceTagOrder input object', () => {
7+
describe('testing fields', () => {
8+
it('has a direction field', () => {
9+
const demoType = guidanceTagOrder.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 = guidanceTagOrder.getFields()
18+
19+
expect(demoType).toHaveProperty('field')
20+
expect(demoType.field.type).toMatchObject(
21+
GraphQLNonNull(GuidanceTagOrderField),
22+
)
23+
})
24+
})
25+
})
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, GuidanceTagOrderField } from '../../enums'
4+
5+
export const guidanceTagOrder = new GraphQLInputObjectType({
6+
name: 'GuidanceTagOrder',
7+
description: 'Ordering options for guidance tag connections.',
8+
fields: () => ({
9+
field: {
10+
type: GraphQLNonNull(GuidanceTagOrderField),
11+
description: 'The field to order guidance tags by.',
12+
},
13+
direction: {
14+
type: GraphQLNonNull(OrderDirection),
15+
description: 'The ordering direction.',
16+
},
17+
}),
18+
})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './guidance-tag-order'

0 commit comments

Comments
 (0)