1
1
import { ApolloServer } from "apollo-server" ;
2
2
import { mergeResolvers , mergeTypeDefs } from "@graphql-tools/merge" ;
3
3
import { connect } from "./database/db.config" ;
4
- import ' ./utils/cronJob' ;
4
+ import " ./utils/cronJob" ;
5
5
import { typeDefsTrainee } from "./schema/traineeApplicantSchema" ;
6
6
import { typeDefsAttribute } from "./schema/traineeAttributeSchema" ;
7
7
import { traineeApplicantResolver } from "./resolvers/traineeApplicantResolver" ;
@@ -30,7 +30,7 @@ import { LoggedUserSchema } from "./schema/loggedUser";
30
30
import { loggedUserResolvers } from "./resolvers/loginUserResolver" ;
31
31
import sendBulkyEmailResolver from "./resolvers/bulkyEmailResolver" ;
32
32
import sendBulkyEmailTypeDefs from "./schema/bulkyEmailTypeDefs" ;
33
- import { roleSchema } from "./schema/roleTypedefs" ;
33
+ import { roleSchema } from "./schema/roleTypedefs" ;
34
34
import { roleResolvers } from "./resolvers/roleResolver" ;
35
35
import { permissionResolvers } from "./resolvers/permissionResolver" ;
36
36
import { permissionSchemaTypeDef } from "./schema/permissionTypeSchema" ;
@@ -40,44 +40,53 @@ import { formSchema } from "./schema/formSchema";
40
40
import { formsResolver } from "./resolvers/forms.resolver" ;
41
41
import { formatError } from "./utils/customErrorHandler" ;
42
42
import { formJobSchema } from "./schema/formJobSchema" ;
43
- import { jobPostResolver } from "./resolvers/jobPostResolvers"
43
+ import { jobPostResolver } from "./resolvers/jobPostResolvers" ;
44
44
import { programTypeDefs } from "./schema/programSchema" ;
45
45
import { programResolvers } from "./resolvers/programResolver" ;
46
46
import { cohortSchema } from "./schema/cohortScheme" ;
47
47
import { cohortResolver } from "./resolvers/cohortResolver" ;
48
- import { viewOwnApplicationTypeDefs } from "./schema/viewOwnApplication" ;
48
+ import { viewOwnApplicationTypeDefs } from "./schema/viewOwnApplication" ;
49
49
import candidateViewOwnApplication from "./resolvers/viewOwnApplicationResolver" ;
50
50
import { gradingTypeDefs } from "./schema/gradingSchema" ;
51
51
import gradingResolver from "./resolvers/grading" ;
52
- import { adminViewApplicationsResolvers } from "./resolvers/adminViewApplications" ;
53
- import { adminViewAllApplicationsTypedefs } from "./schema/adminViewApplicationsSchema" ;
52
+ import { adminViewApplicationsResolvers } from "./resolvers/adminViewApplications" ;
53
+ import { adminViewAllApplicationsTypedefs } from "./schema/adminViewApplicationsSchema" ;
54
54
import { attendanceResolver } from "./resolvers/attendanceResolver" ;
55
55
import { attendanceSchema } from "./schema/attendanceSchema" ;
56
56
import { performanceResolver } from "./resolvers/performanceResolver" ;
57
57
import { performanceSchema } from "./schema/performanceSchema" ;
58
- import { applicationStageDefs } from ' ./schema/applicationStage' ;
59
- import { applicationStageResolvers } from ' ./resolvers/applicationStageResolver' ;
58
+ import { applicationStageDefs } from " ./schema/applicationStage" ;
59
+ import { applicationStageResolvers } from " ./resolvers/applicationStageResolver" ;
60
60
import filterJobResolver from "./resolvers/filterJob" ;
61
61
import filterProgramResolver from "./resolvers/filterPrograms" ;
62
62
import filterRoleResolver from "./resolvers/filterRole" ;
63
- import applicantNotificationResolver from "./resolvers/applicantNotifications"
64
- import applicantNotifcationsTypedefs from "./schema/applicantNotifications"
63
+ import applicantNotificationResolver from "./resolvers/applicantNotifications" ;
64
+ import applicantNotifcationsTypedefs from "./schema/applicantNotifications" ;
65
65
// import {forgetPassword } from "./resolvers/forgetpassword";
66
- import { passwordResolvers } from ' ./resolvers/forgetpassword' ;
66
+ import { passwordResolvers } from " ./resolvers/forgetpassword" ;
67
67
import { passwordSchema } from "./schema/forgetpassword" ;
68
68
import { SearchSchema } from "./schema/searchSchema" ;
69
69
import { searchResolver } from "./resolvers/searchResolver" ;
70
- import { appliedJobResolver } from "./resolvers/appliedJobResolver" ;
70
+ import { appliedJobResolver } from "./resolvers/appliedJobResolver" ;
71
71
import { appliedJobTypeDefs } from "./schema/appliedJobTypeDefs" ;
72
72
import { adminNotificationsResolver } from "./resolvers/adminNotificationsResolver" ;
73
- import { adminNotificationsSchema } from "./schema/adminNotificationsSchema" ; import { ticketResolver } from "./resolvers/ticketResolver" ;
73
+ import { adminNotificationsSchema } from "./schema/adminNotificationsSchema" ;
74
+ import { ticketResolver } from "./resolvers/ticketResolver" ;
74
75
import { ticketSchema } from "./schema/ticketSchema" ;
75
76
import filterTicketResolver from "./resolvers/filterTicketResolver" ;
77
+ import { blogResolvers } from "./resolvers/blogResolvers" ;
78
+ import { blogSchema } from "./schema/blogSchema" ;
79
+ import { likeResolvers } from "./resolvers/likeResolvers" ;
80
+ import { likeSchema } from "./schema/likeSchema" ;
81
+ import { commentResolvers } from "./resolvers/commentResolvers" ;
82
+ import { commentSchema } from "./schema/commentSchema" ;
83
+ import { commentReplySchema } from "./schema/commentReplySchema" ;
84
+ import { commentLikeSchema } from "./schema/commentLikeSchema" ;
85
+ import { commentLikeResolvers } from "./resolvers/commentLikeResolvers" ;
86
+ import { commentReplyResolvers } from "./resolvers/commentReplyResolvers" ;
76
87
77
88
const PORT = process . env . PORT || 3000 ;
78
89
79
- // const PORT = process.env.PORT || 4001;
80
-
81
90
const resolvers = mergeResolvers ( [
82
91
applicationCycleResolver ,
83
92
usersResolvers ,
@@ -115,7 +124,12 @@ const resolvers = mergeResolvers([
115
124
adminNotificationsResolver ,
116
125
ticketResolver ,
117
126
filterTicketResolver ,
118
- applicationStageResolvers
127
+ applicationStageResolvers ,
128
+ blogResolvers ,
129
+ likeResolvers ,
130
+ commentResolvers ,
131
+ commentLikeResolvers ,
132
+ commentReplyResolvers ,
119
133
] ) ;
120
134
const typeDefs = mergeTypeDefs ( [
121
135
applicationCycleTypeDefs ,
@@ -151,8 +165,11 @@ const typeDefs = mergeTypeDefs([
151
165
applicationStageDefs ,
152
166
adminNotificationsSchema ,
153
167
ticketSchema ,
154
- applicationStageDefs ,
155
- applicationStageDefs
168
+ blogSchema ,
169
+ likeSchema ,
170
+ commentSchema ,
171
+ commentReplySchema ,
172
+ commentLikeSchema ,
156
173
] ) ;
157
174
158
175
const server = new ApolloServer ( {
@@ -163,11 +180,12 @@ const server = new ApolloServer({
163
180
let authToken = null ;
164
181
let currentUser = null ;
165
182
try {
166
- authToken = req . headers . authorization && req . headers . authorization . startsWith ( "Bearer " )
167
- ? req . headers . authorization . split ( " " ) [ 1 ]
168
- : req . headers . authorization ;
183
+ authToken =
184
+ req . headers . authorization &&
185
+ req . headers . authorization . startsWith ( "Bearer " )
186
+ ? req . headers . authorization . split ( " " ) [ 1 ]
187
+ : req . headers . authorization ;
169
188
if ( authToken ) {
170
-
171
189
currentUser = await findOrCreateUser ( authToken ) ;
172
190
}
173
191
} catch ( error ) {
@@ -182,5 +200,5 @@ const server = new ApolloServer({
182
200
183
201
connect ( ) . then ( ( ) => {
184
202
console . log ( "Database connected!" ) ;
185
- server . listen ( PORT ) . then ( ( { url } ) => console . info ( `App on ${ url } ` ) ) ;
186
- } ) ;
203
+ server . listen ( PORT ) . then ( ( { url } ) => console . info ( `App on ${ url } ` ) ) ;
204
+ } ) ;
0 commit comments