You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/withdrawn-migration/backup.js
+22-8
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,27 @@ async function backup () {
22
22
23
23
for(leti=0;i<jobCandidates.length;i++){
24
24
constjc=jobCandidates[i]
25
-
constjob=awaitJob.findById(jc.jobId)
26
-
constrb=awaitResourceBooking.findOne({
27
-
where: {
28
-
userId: jc.userId,
29
-
jobId: jc.jobId
30
-
}
31
-
})
25
+
letjob=null
26
+
try{
27
+
job=awaitJob.findById(jc.jobId)
28
+
}catch(error){
29
+
// log the error
30
+
logger.info({component: currentStep,message: `==> Data integrity issue: Can't find the Job with Id ${jc.jobId}`})
31
+
}
32
+
if(!job)continue
33
+
letrb=null
34
+
try{
35
+
rb=awaitResourceBooking.findOne({
36
+
where: {
37
+
userId: jc.userId,
38
+
jobId: jc.jobId
39
+
}
40
+
})
41
+
}catch(error){
42
+
// log the error
43
+
logger.info({component: currentStep,message: `==> Data integrity issue: Can't find the ResourceBooking whose userId is ${jc.userId} and jobId is ${jc.jobId}`})
0 commit comments