Skip to content

Migrate jobcandidates scripts V4 #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions data/demo-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"isApplicationPageActive": false,
"minSalary": 100,
"maxSalary": 200,
"hoursPerWeek": 20,
"hoursPerWeek": 90,
"jobLocation": "Any location",
"jobTimezone": "GMT",
"currency": "USD",
Expand Down Expand Up @@ -833,9 +833,9 @@
},
{
"id": "881a19de-2b0c-4bb9-b36a-4cb5e223bdb5",
"jobId": "728ff056-63f6-4730-8a9f-3074acad8479",
"jobId": "a8adb1f8-a6ee-48b1-8661-33bd851b726e",
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
"status": "open",
"status": "placed",
"externalId": "300234321",
"resume": "http://example.com",
"remark": "excellent",
Expand Down Expand Up @@ -1645,11 +1645,11 @@
{
"id": "c0a12936-77ef-46fa-8c75-6996339e79f6",
"projectId": 111,
"userId": "05e988b7-7d54-4c10-ada1-1a04870a88a8",
"jobId": "a8adb1f8-a6ee-48b1-8661-33bd851b726e",
"userId": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
"status": "placed",
"startDate": "2020-09-27",
"endDate": "2020-10-27",
"endDate": "2021-10-27",
"memberRate": 13.23,
"customerRate": 13,
"rateType": "hourly",
Expand Down
2 changes: 1 addition & 1 deletion scripts/demo-email-notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function resetNotificationRecords () {
// reset coming up interview records
localLogger.info('reset coming up interview records')
const interview = await Interview.findById('976d23a9-5710-453f-99d9-f57a588bb610')
const startTimestamp = moment().add(moment.duration(`PT1H`)).add('PT1M').toDate()
const startTimestamp = moment().add(moment.duration('PT1H')).add('PT1M').toDate()
await interview.update({ startTimestamp, duration: 30, status: Interviews.Status.Scheduled, guestNames: ['test1', 'test2'], hostName: 'hostName' })

// reset completed interview records
Expand Down
20 changes: 11 additions & 9 deletions scripts/withdrawn-migration/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ async function backup () {
}
})
let summary = 0
const processMapping = {}
for (let i = 0; i < jobCandidates.length; i++) {
const jc = jobCandidates[i]
if (processMapping[jc.userId]) continue
let job = null
try {
job = await Job.findById(jc.jobId)
Expand Down Expand Up @@ -60,17 +62,17 @@ async function backup () {
where: filter
})
if (candidates && candidates.length > 0) {
summary += candidates.length
fs.writeFile(filePath + `jobcandidate-backup-${i+1}.json`, JSON.stringify(
candidates
), (err) => {
if (!err) {
logger.info({ component: `${currentStep} Sub`, message: `There are ${candidates.length} jobCandidates that need to be updated for userId: ${jc.userId}` })
return
}
try {
fs.writeFileSync(filePath + `jobcandidate-backup-${i + 1}.json`, JSON.stringify(
candidates
))
logger.info({ component: `${currentStep} Sub`, message: `There are ${candidates.length} jobCandidates that need to be updated for userId: ${jc.userId}` })
summary += candidates.length
processMapping[jc.userId] = true
} catch (err) {
logger.error({ component: currentStep, message: err.message })
process.exit(1)
})
}
}
}
}
Expand Down