|
1 | 1 | import { makeExecutableSchema, gql } from "apollo-server-express"; |
2 | 2 | import { applyMiddleware } from "graphql-middleware"; |
3 | 3 | import { merge } from "lodash"; |
4 | | -import { GraphQLScalarType, Kind } from "graphql"; |
5 | 4 |
|
6 | 5 | import { |
7 | 6 | isAuthorizedByEmail, |
@@ -37,54 +36,20 @@ const mutation = gql` |
37 | 36 | } |
38 | 37 | `; |
39 | 38 |
|
40 | | -const scalarTypes = gql` |
41 | | - scalar JSON |
42 | | -`; |
43 | | - |
44 | | -const JSONScalar = new GraphQLScalarType({ |
45 | | - name: "JSON", |
46 | | - description: "JSON scalar type", |
47 | | - serialize: (value) => value, |
48 | | - parseValue: (value) => value, |
49 | | - parseLiteral: (ast) => { |
50 | | - switch (ast.kind) { |
51 | | - case Kind.STRING: |
52 | | - case Kind.BOOLEAN: |
53 | | - return ast.value; |
54 | | - case Kind.INT: |
55 | | - case Kind.FLOAT: |
56 | | - return parseFloat(ast.value); |
57 | | - case Kind.OBJECT: |
58 | | - return ast.fields.reduce((obj: any, field: any) => { |
59 | | - obj[field.name.value] = JSONScalar.parseLiteral(field.value, {}); |
60 | | - return obj; |
61 | | - }, {}); |
62 | | - case Kind.LIST: |
63 | | - return ast.values.map((value: any) => JSONScalar.parseLiteral(value, {})); |
64 | | - default: |
65 | | - return null; |
66 | | - } |
67 | | - }, |
68 | | -}); |
69 | | - |
70 | 39 | const executableSchema = makeExecutableSchema({ |
71 | 40 | typeDefs: [ |
72 | 41 | query, |
73 | 42 | mutation, |
74 | | - scalarTypes, |
75 | 43 | authType, |
76 | 44 | entityType, |
77 | 45 | simpleEntityType, |
78 | 46 | userType, |
79 | 47 | reviewDashboardType, |
80 | | - reviewedApplicantRecordTypes |
| 48 | + reviewedApplicantRecordTypes, |
81 | 49 | adminCommentType, |
82 | 50 | reviewPageType, |
83 | 51 | ], |
84 | 52 | resolvers: merge( |
85 | | - { |
86 | | - JSON: JSONScalar, |
87 | | - }, |
88 | 53 | authResolvers, |
89 | 54 | entityResolvers, |
90 | 55 | simpleEntityResolvers, |
@@ -118,10 +83,6 @@ const graphQLMiddlewares = { |
118 | 83 | createSimpleEntity: authorizedByAllRoles(), |
119 | 84 | updateSimpleEntity: authorizedByAllRoles(), |
120 | 85 | deleteSimpleEntity: authorizedByAllRoles(), |
121 | | - changeRating: authorizedByAllRoles(), |
122 | | - changeSkillCategory: authorizedByAllRoles(), |
123 | | - updateApplications: authorizedByAllRoles(), |
124 | | - modifyFinalComments: authorizedByAllRoles(), |
125 | 86 | createReviewedApplicantRecord: authorizedByAllRoles(), |
126 | 87 | bulkCreateReviewedApplicantRecord: authorizedByAllRoles(), |
127 | 88 | deleteReviewedApplicantRecord: authorizedByAllRoles(), |
|
0 commit comments