forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-shared.js
More file actions
63 lines (61 loc) · 2 KB
/
Copy pathuser-shared.js
File metadata and controls
63 lines (61 loc) · 2 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
import {GraphQLBoolean, GraphQLObjectType, GraphQLString} from 'graphql'
import {connectionArgs, globalIdField} from 'graphql-relay'
import {GraphQLEmailAddress} from 'graphql-scalars'
import {affiliationOrgOrder} from '../../affiliation/inputs'
import {affiliationConnection} from '../../affiliation/objects'
import {nodeInterface} from '../../node'
export const userSharedType = new GraphQLObjectType({
name: 'SharedUser',
fields: () => ({
id: globalIdField('user'),
displayName: {
type: GraphQLString,
description: 'Users display name.',
resolve: ({displayName}) => displayName,
},
userName: {
type: GraphQLEmailAddress,
description: 'Users email address.',
resolve: ({userName}) => userName,
},
emailValidated: {
type: GraphQLBoolean,
description: 'Has the user email verified their account.',
resolve: ({emailValidated}) => emailValidated,
},
insideUser: {
type: GraphQLBoolean,
description: 'Does the user want to see new features in progress.',
resolve: ({ insideUser }) => insideUser,
},
affiliations: {
type: affiliationConnection.connectionType,
description: 'Users affiliations to various organizations.',
args: {
orderBy: {
type: affiliationOrgOrder,
description: 'Ordering options for affiliation connections.',
},
search: {
type: GraphQLString,
description: 'String used to search for affiliated organizations.',
},
...connectionArgs,
},
resolve: async (
{_id},
args,
{loaders: {loadAffiliationConnectionsByUserId}},
) => {
const affiliations = await loadAffiliationConnectionsByUserId({
userId: _id,
...args,
})
return affiliations
},
},
}),
interfaces: [nodeInterface],
description: `This object is used for showing none personal user details,
and is used for limiting admins to the personal details of users.`,
})