File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed
scripts/withdrawn-migration Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 86
86
"isApplicationPageActive" : false ,
87
87
"minSalary" : 100 ,
88
88
"maxSalary" : 200 ,
89
- "hoursPerWeek" : 20 ,
89
+ "hoursPerWeek" : 90 ,
90
90
"jobLocation" : " Any location" ,
91
91
"jobTimezone" : " GMT" ,
92
92
"currency" : " USD" ,
833
833
},
834
834
{
835
835
"id" : " 881a19de-2b0c-4bb9-b36a-4cb5e223bdb5" ,
836
- "jobId" : " 728ff056-63f6-4730-8a9f-3074acad8479 " ,
836
+ "jobId" : " a8adb1f8-a6ee-48b1-8661-33bd851b726e " ,
837
837
"userId" : " a55fe1bc-1754-45fa-9adc-cf3d6d7c377a" ,
838
- "status" : " open " ,
838
+ "status" : " placed " ,
839
839
"externalId" : " 300234321" ,
840
840
"resume" : " http://example.com" ,
841
841
"remark" : " excellent" ,
1645
1645
{
1646
1646
"id" : " c0a12936-77ef-46fa-8c75-6996339e79f6" ,
1647
1647
"projectId" : 111 ,
1648
- "userId" : " 05e988b7-7d54-4c10-ada1-1a04870a88a8" ,
1649
1648
"jobId" : " a8adb1f8-a6ee-48b1-8661-33bd851b726e" ,
1649
+ "userId" : " a55fe1bc-1754-45fa-9adc-cf3d6d7c377a" ,
1650
1650
"status" : " placed" ,
1651
1651
"startDate" : " 2020-09-27" ,
1652
- "endDate" : " 2020 -10-27" ,
1652
+ "endDate" : " 2021 -10-27" ,
1653
1653
"memberRate" : 13.23 ,
1654
1654
"customerRate" : 13 ,
1655
1655
"rateType" : " hourly" ,
Original file line number Diff line number Diff line change @@ -24,8 +24,10 @@ async function backup () {
24
24
}
25
25
} )
26
26
let summary = 0
27
+ const processMapping = { }
27
28
for ( let i = 0 ; i < jobCandidates . length ; i ++ ) {
28
29
const jc = jobCandidates [ i ]
30
+ if ( processMapping [ jc . userId ] ) continue
29
31
let job = null
30
32
try {
31
33
job = await Job . findById ( jc . jobId )
@@ -60,17 +62,17 @@ async function backup () {
60
62
where : filter
61
63
} )
62
64
if ( candidates && candidates . length > 0 ) {
63
- summary += candidates . length
64
- fs . writeFile ( filePath + `jobcandidate-backup-${ i + 1 } .json` , JSON . stringify (
65
- candidates
66
- ) , ( err ) => {
67
- if ( ! err ) {
68
- logger . info ( { component : ` ${ currentStep } Sub` , message : `There are ${ candidates . length } jobCandidates that need to be updated for userId: ${ jc . userId } ` } )
69
- return
70
- }
65
+ try {
66
+ fs . writeFileSync ( filePath + `jobcandidate-backup-${ i + 1 } .json` , JSON . stringify (
67
+ candidates
68
+ ) )
69
+ logger . info ( { component : ` ${ currentStep } Sub` , message : `There are ${ candidates . length } jobCandidates that need to be updated for userId: ${ jc . userId } ` } )
70
+ summary += candidates . length
71
+ processMapping [ jc . userId ] = true
72
+ } catch ( err ) {
71
73
logger . error ( { component : currentStep , message : err . message } )
72
74
process . exit ( 1 )
73
- } )
75
+ }
74
76
}
75
77
}
76
78
}
You can’t perform that action at this time.
0 commit comments