Closed
Description
Background
Recently we've added a new field to the Job Model isApplicationPageActive
. This field in TaaS API reflects the same value in RCRM. We already have existent Jobs in RCRM, so we would have to sync values from RCRM to TaaS API for existent jobs.
Task
We should implement this script a similar way as we've implemented scripts/recruit-crm-job-import
as per issue #101.
- Create a script inside
scripts
directory. I should have its own directory, which would contain:index.js
- the script itself to runREADME.md
- brief readme on how to run the script (which ENV vars to set and how to point CSV file)
- As we need to add data to both DB and ES, I guess the easier way would be make the script call TaaS API for creating jobs.
- We would have around
400
jobs in real data. - Script should get all params as ENV variables (for example M2M token config for calling TaaS API) or anything else
- CSV file path should be provided as an argument.
CSV file example
task-isApplicationPageActive.csv.zip
Script workflow
- From the CSV file, only 2 fields needs to be used Allow Apply and Slug
- Mapping between TaaS API and CSV file values:
csv-file.Allow Apply
=job.IsApplicationpageActive
csv-file.slug
=job.externalId
.
- Read records in CSV file one by one
- Search
job.id
byjob.externalId
- Update the job record by
job.id
- If Allow Apply =
Yes
,isApplicationPageActive = true
- if Allow Apply =
No
,isApplicationPageActive = false
- If Allow Apply =
Script Logging
When the job is done show summary information about script work like this:
No. of records Read = 6
No. of records updated for field IsApplicationPageActive = true = 3
No. of records updated for field IsApplicationPageActive = false = 2
No. of records : ExternalId not found: x
No. of records failed : 1
List any error if any.