File tree 3 files changed +39
-1
lines changed
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -413,7 +413,28 @@ export const applicationStageResolvers: any = {
413
413
} ,
414
414
}
415
415
) ;
416
-
416
+ const updatedApplicant = await TraineeApplicant . findOne ( {
417
+ _id : applicantId ,
418
+ } )
419
+ . populate ( "email" )
420
+ . lean ( ) ;
421
+
422
+ const email = updatedApplicant ?. email ;
423
+
424
+ if ( email ) {
425
+ await LoggedUserModel . updateOne (
426
+ { email } ,
427
+ {
428
+ $set : {
429
+ applicationPhase : nextStage ,
430
+ status : "Admitted" ,
431
+ role : traineeRole . _id ,
432
+ } ,
433
+ }
434
+ ) ;
435
+ } else {
436
+ throw new Error ( "Email not found for the provided applicant ID" ) ;
437
+ }
417
438
const notification2 = await ApplicantNotificationsModel . create ( {
418
439
userId : user ! . _id ,
419
440
message,
Original file line number Diff line number Diff line change
1
+ import { BlogModel } from "../models/blogModel" ;
2
+ import { CommentModel } from "../models/commentModel" ;
3
+ import { LikeModel } from "../models/likeModel" ;
4
+ import { CommentLikeModel } from "../models/commentLike" ;
5
+ import { CommentReplyModel } from "../models/CommentReply" ;
6
+
7
+ const seedBlogs = async ( ) => {
8
+ await BlogModel . deleteMany ( { } ) ;
9
+ await CommentModel . deleteMany ( { } ) ;
10
+ await CommentLikeModel . deleteMany ( { } ) ;
11
+ await LikeModel . deleteMany ( { } ) ;
12
+ await CommentReplyModel . deleteMany ( { } ) ;
13
+ } ;
14
+
15
+ export default seedBlogs ;
Original file line number Diff line number Diff line change 1
1
import { connect } from '../database/db.config'
2
+ import seedBlogs from "./blogs" ;
2
3
3
4
import seedDeleteTrainee from './DelTrainee' ;
4
5
import seedJobs from './jobs' ;
@@ -16,5 +17,6 @@ connect().then(async () => {
16
17
await seedCohorts ( ) ;
17
18
await seedJobs ( ) ;
18
19
await seedApplications ( ) ;
20
+ await seedBlogs ( ) ;
19
21
process . exit ( )
20
22
} )
You can’t perform that action at this time.
0 commit comments