From 006b109ae9fb7c8283050f826377f65abec6e52c Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Wed, 13 Oct 2021 16:33:57 +0800 Subject: [PATCH 01/15] Support to special=false and featured query param (#569) * special job false * db special false * ci:deploying * support featured search * restore ci --- data/demo-data.json | 1 + docs/swagger.yaml | 6 ++++++ src/services/JobService.js | 30 ++++++++++++++++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/data/demo-data.json b/data/demo-data.json index ccf636a8..65d8e306 100644 --- a/data/demo-data.json +++ b/data/demo-data.json @@ -1325,6 +1325,7 @@ "externalId": "300234321", "resume": "http://example.com", "remark": "excellent", + "featured": null, "createdBy": "00000000-0000-0000-0000-000000000000", "updatedBy": "00000000-0000-0000-0000-000000000000", "createdAt": "2021-05-09T21:15:02.183Z", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 98991993..43a9425b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -213,6 +213,12 @@ paths: schema: type: boolean description: When passing true, the API will load all featured and showInHotList jobs at once + - in: query + name: featured + required: false + schema: + type: boolean + description: The featured jobs requestBody: content: application/json: diff --git a/src/services/JobService.js b/src/services/JobService.js index 382b1f12..9dee15ea 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -481,7 +481,8 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } 'minSalary', 'maxSalary', 'jobLocation', - 'specialJob' + 'specialJob', + 'featured' ]), (value, key) => { let must if (key === 'description' || key === 'title') { @@ -532,7 +533,22 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } } } } else { - return true + must = { + bool: { + must: [ + { + term: { + featured: value + } + }, + { + term: { + showInHotList: value + } + } + ] + } + } } } else { must = { @@ -601,7 +617,8 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } 'resourceType', 'rateType', 'workload', - 'status' + 'status', + 'featured' ]), (value, key) => { filter[Op.and].push({ [key]: value }) }) @@ -674,6 +691,10 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } ] }) } + if (criteria.specialJob === false) { + filter[Op.and].push({ featured: false }) + filter[Op.and].push({ showInHotList: false }) + } const jobs = await Job.findAll({ where: filter, offset: ((page - 1) * perPage), @@ -720,7 +741,8 @@ searchJobs.schema = Joi.object().keys({ minSalary: Joi.number().integer(), maxSalary: Joi.number().integer(), jobLocation: Joi.string(), - specialJob: Joi.boolean() + specialJob: Joi.boolean(), + featured: Joi.boolean() }).required(), options: Joi.object() }).required() From 92355a35ef62da79a0916a437c30c4e6cb474c33 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Wed, 13 Oct 2021 23:14:26 +0800 Subject: [PATCH 02/15] [Ready Release] Gigs listing - Jobs special false and featured query param (#570) * special job false * db special false * ci:deploying * support featured search * restore ci From 7d5349d59e51e8b81271a29b1a1249d1edfc9c69 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 14 Oct 2021 22:01:34 +0800 Subject: [PATCH 03/15] api update --- docs/swagger.yaml | 50 ++++++++++++++++++++++++++++++++++++++ src/bootstrap.js | 1 + src/models/Job.js | 12 +++++++++ src/services/JobService.js | 23 ++++++++++++------ 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 43a9425b..389f826a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -219,6 +219,12 @@ paths: schema: type: boolean description: The featured jobs + - in: query + name: rcrmStatus + required: false + schema: + type: string + enum: ["Open", "On Hold", "Canceled", "Draft", "Closed"] requestBody: content: application/json: @@ -4128,6 +4134,32 @@ components: type: string example: "USD" description: "the currency of job" + showInHotList: + type: boolean + default: false + description: "Whether to show job in hot list" + featured: + type: boolean + default: false + description: "Whether a job is a featured job" + hotListExcerpt: + type: string + default: '' + description: "A text to show for the hotlist excerpt" + jobTag: + type: string + default: '' + enum: ["New", "$$$", "Hot", ""] + description: "the job tag" + rcrmStatus: + type: string + default: null + enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"] + description: "the job rcrm status" + rcrmReason: + type: string + default: null + description: "the possible rcrm reason for current status" createdAt: type: string format: date-time @@ -4247,6 +4279,15 @@ components: type: string enum: ["", "New", "$$$", "Hot"] description: "The tag of a job" + rcrmStatus: + type: string + default: null + enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"] + description: "the job rcrm status" + rcrmReason: + type: string + default: null + description: "the possible rcrm reason for current status" isApplicationPageActive: type: boolean default: false @@ -4803,6 +4844,15 @@ components: type: string enum: ["", "New", "$$$", "Hot"] description: "The tag of a job" + rcrmStatus: + type: string + default: null + enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"] + description: "the job rcrm status" + rcrmReason: + type: string + default: null + description: "the possible rcrm reason for current status" isApplicationPageActive: type: boolean default: false diff --git a/src/bootstrap.js b/src/bootstrap.js index 86288eca..17c21fb5 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -13,6 +13,7 @@ Joi.page = () => Joi.number().integer().min(1).default(1) Joi.perPage = () => Joi.number().integer().min(1).default(20) Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly', 'annual') Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled') +Joi.jobRcrmStatus = () => Joi.string().valid('Open', 'On Hold', 'Canceled', 'Draft', 'Closed').allow(null) Joi.jobTag = () => Joi.string().valid('New', '$$$', 'Hot').allow('') Joi.resourceBookingStatus = () => Joi.string().valid('placed', 'closed', 'cancelled') Joi.workload = () => Joi.string().valid('full-time', 'fractional') diff --git a/src/models/Job.js b/src/models/Job.js index 90d9cf25..d3f8ec41 100644 --- a/src/models/Job.js +++ b/src/models/Job.js @@ -164,6 +164,18 @@ module.exports = (sequelize) => { allowNull: true, defaultValue: '' }, + rcrmStatus: { + field: 'rcrm_status', + type: Sequelize.STRING(255), + allowNull: true, + defaultValue: null + }, + rcrmReason: { + field: 'rcrm_reason', + type: Sequelize.STRING(255), + allowNull: true, + defaultValue: null + }, createdBy: { field: 'created_by', type: Sequelize.UUID, diff --git a/src/services/JobService.js b/src/services/JobService.js index 9dee15ea..c4ebd60c 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -235,7 +235,9 @@ createJob.schema = Joi.object() showInHotList: Joi.boolean().default(false), featured: Joi.boolean().default(false), hotListExcerpt: Joi.stringAllowEmpty().default(''), - jobTag: Joi.jobTag().default('') + jobTag: Joi.jobTag().default(''), + rcrmStatus: Joi.jobRcrmStatus().default('Open'), + rcrmReason: Joi.string().allow(null).default(null) }) .required(), onTeamCreating: Joi.boolean().default(false) @@ -335,7 +337,9 @@ partiallyUpdateJob.schema = Joi.object() showInHotList: Joi.boolean(), featured: Joi.boolean(), hotListExcerpt: Joi.stringAllowEmpty(), - jobTag: Joi.jobTag() + jobTag: Joi.jobTag(), + rcrmStatus: Joi.jobRcrmStatus(), + rcrmReason: Joi.string().allow(null) }) .required() }) @@ -379,7 +383,9 @@ fullyUpdateJob.schema = Joi.object().keys({ showInHotList: Joi.boolean().default(false), featured: Joi.boolean().default(false), hotListExcerpt: Joi.stringAllowEmpty().default(''), - jobTag: Joi.jobTag().default('') + jobTag: Joi.jobTag().default(''), + rcrmStatus: Joi.jobRcrmStatus().default(null), + rcrmReason: Joi.string().allow(null).default(null) }).required() }).required() @@ -482,10 +488,11 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } 'maxSalary', 'jobLocation', 'specialJob', - 'featured' + 'featured', + 'rcrmStatus' ]), (value, key) => { let must - if (key === 'description' || key === 'title') { + if (key === 'description' || key === 'title' || key === 'rcrmStatus') { must = { match: { [key]: { @@ -618,7 +625,8 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } 'rateType', 'workload', 'status', - 'featured' + 'featured', + 'rcrmStatus' ]), (value, key) => { filter[Op.and].push({ [key]: value }) }) @@ -742,7 +750,8 @@ searchJobs.schema = Joi.object().keys({ maxSalary: Joi.number().integer(), jobLocation: Joi.string(), specialJob: Joi.boolean(), - featured: Joi.boolean() + featured: Joi.boolean(), + rcrmStatus: Joi.string().valid('Open', 'On Hold', 'Canceled', 'Draft', 'Closed') }).required(), options: Joi.object() }).required() From 86670770da5457153f64ebde9228ba23321394b7 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 14 Oct 2021 22:28:21 +0800 Subject: [PATCH 04/15] add migration scripts --- .../2021-10-14-job-add-job-rcrm-status.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 migrations/2021-10-14-job-add-job-rcrm-status.js diff --git a/migrations/2021-10-14-job-add-job-rcrm-status.js b/migrations/2021-10-14-job-add-job-rcrm-status.js new file mode 100644 index 00000000..89b4920e --- /dev/null +++ b/migrations/2021-10-14-job-add-job-rcrm-status.js @@ -0,0 +1,37 @@ +const config = require('config') + +/* + * Add rcrm_status, rcrm_reason to the Job model. +type: Sequelize.STRING(255), + defaultValue: null, + allowNull: true + */ + +module.exports = { + up: async (queryInterface, Sequelize) => { + const transaction = await queryInterface.sequelize.transaction() + try { + await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'rcrm_status', + { type: Sequelize.STRING(255), allowNull: true, defaultValue: null }, + { transaction }) + await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'rcrm_reason', + { type: Sequelize.STRING(255), allowNull: true, defaultValue: null }, + { transaction }) + await transaction.commit() + } catch (err) { + await transaction.rollback() + throw err + } + }, + down: async (queryInterface, Sequelize) => { + const transaction = await queryInterface.sequelize.transaction() + try { + await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'rcrm_status', { transaction }) + await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'rcrm_reason', { transaction }) + await transaction.commit() + } catch (err) { + await transaction.rollback() + throw err + } + } +} From eb10a3bcfdf02208f2f0d8230c72a150e1c75be7 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 14 Oct 2021 22:29:39 +0800 Subject: [PATCH 05/15] ci:deploying --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b91a021d..37a30584 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,6 +68,7 @@ workflows: branches: only: - dev + - gigs-listing-rcrmstatus # Production builds are exectuted only on tagged commits to the # master branch. From 83ef0598826b4404010923223d7b20eb3c850719 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 14 Oct 2021 23:16:25 +0800 Subject: [PATCH 06/15] migration scripts --- package.json | 5 +- scripts/job-rcrm-status-migration/backup.js | 41 ++++++++++++++++ .../job-rcrm-status-migration/migration.js | 49 +++++++++++++++++++ scripts/job-rcrm-status-migration/restore.js | 49 +++++++++++++++++++ .../temp/jobs-backup.json | 1 + 5 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 scripts/job-rcrm-status-migration/backup.js create mode 100644 scripts/job-rcrm-status-migration/migration.js create mode 100644 scripts/job-rcrm-status-migration/restore.js create mode 100644 scripts/job-rcrm-status-migration/temp/jobs-backup.json diff --git a/package.json b/package.json index 38990be6..b7e69924 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,10 @@ "demo-payment": "node scripts/demo-payment", "migrate:backup-withdrawn": "node scripts/withdrawn-migration/backup.js", "migrate:migration-withdrawn": "node scripts/withdrawn-migration/migration.js", - "migrate:restore-withdrawn": "node scripts/withdrawn-migration/restore.js" + "migrate:restore-withdrawn": "node scripts/withdrawn-migration/restore.js", + "migrate:backup-rcrm-status": "node scripts/job-rcrm-status-migration/backup.js", + "migrate:migration-rcrm-status": "node scripts/job-rcrm-status-migration/migration.js", + "migrate:restore-rcrm-status": "node scripts/job-rcrm-status-migration/restore.js" }, "keywords": [], "author": "", diff --git a/scripts/job-rcrm-status-migration/backup.js b/scripts/job-rcrm-status-migration/backup.js new file mode 100644 index 00000000..9a0f2ff5 --- /dev/null +++ b/scripts/job-rcrm-status-migration/backup.js @@ -0,0 +1,41 @@ +/** + * Back up the jobs that we will update it's status + */ +const fs = require('fs') +const path = require('path') +const request = require('superagent') +const logger = require('../../src/common/logger') + +const currentStep = 'Backup' + +async function backup () { + logger.info({ component: currentStep, message: '*************************** Backup process started ***************************' }) + const filePath = path.join(__dirname, '/temp/') + if (fs.existsSync(filePath)) { + fs.rmdirSync(filePath, { recursive: true }) + } + fs.mkdirSync(filePath) + let { body: jobs } = await request.get('https://www.topcoder.com/api/recruit/jobs?job_status=1&enable_job_application_form=1') + jobs = jobs.map((item) => item.slug) + if (jobs && jobs.length > 0) { + try { + fs.writeFileSync(filePath + 'jobs-backup.json', JSON.stringify( + jobs + )) + logger.info({ component: `${currentStep} Sub`, message: `There are ${jobs.length} jobs that need to be updated` }) + } catch (err) { + logger.error({ component: currentStep, message: err.message }) + process.exit(1) + } + } + logger.info({ component: `${currentStep}`, message: `Report: there are ${jobs.length} jobs in total` }) + logger.info({ component: currentStep, message: '*************************** Backup process finished ***************************' }) +} + +backup().then(() => { + logger.info({ component: currentStep, message: 'Execution Finished!' }) + process.exit() +}).catch(err => { + logger.error(err.message) + process.exit(1) +}) diff --git a/scripts/job-rcrm-status-migration/migration.js b/scripts/job-rcrm-status-migration/migration.js new file mode 100644 index 00000000..23236f13 --- /dev/null +++ b/scripts/job-rcrm-status-migration/migration.js @@ -0,0 +1,49 @@ +/** + * Migration the job rcrm status into Open status + */ +const fs = require('fs') +const path = require('path') +const { Job } = require('../../src/models') +const logger = require('../../src/common/logger') + +const currentStep = 'Migration' + +async function migration () { + logger.info({ component: currentStep, message: '*************************** Migration process started ***************************' }) + const filePath = path.join(__dirname, '/temp/') + const files = [] + fs.readdirSync(filePath).forEach(async (file) => { + files.push(`${filePath}${file}`) + }) + let totalSum = 0 + for (let j = 0; j < files.length; j++) { + const data = fs.readFileSync(files[j], 'utf-8') + const rcrmIds = JSON.parse(data) + let summary = 0 + for (let i = 0; i < rcrmIds.length; i++) { + const jbs = await Job.findAll({ + where: { externalId: rcrmIds[i] } + }) + for (let j = 0; j < jbs.length; j++) { + if (jbs[j]) { + const oldStatus = jbs[j].rcrmStatus + const updated = await jbs[j].update({ rcrmStatus: 'Open' }) + summary++ + totalSum++ + logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.status}` }) + } + } + }; + logger.info({ component: `${currentStep} Sub`, message: `Updated ${summary} jobs from ${files[j]}` }) + } + logger.info({ component: currentStep, message: `Report: Totally Updated ${totalSum} jobs` }) + logger.info({ component: currentStep, message: '*************************** Migration process finished ***************************' }) +} + +migration().then(() => { + logger.info({ component: currentStep, message: 'Execution Finished!' }) + process.exit() +}).catch(err => { + logger.error(err.message) + process.exit(1) +}) diff --git a/scripts/job-rcrm-status-migration/restore.js b/scripts/job-rcrm-status-migration/restore.js new file mode 100644 index 00000000..29a88bda --- /dev/null +++ b/scripts/job-rcrm-status-migration/restore.js @@ -0,0 +1,49 @@ +/** + * Restore the job rcrm status into Open status + */ +const fs = require('fs') +const path = require('path') +const { Job } = require('../../src/models') +const logger = require('../../src/common/logger') + +const currentStep = 'Restore' + +async function restore () { + logger.info({ component: currentStep, message: '*************************** Restore process started ***************************' }) + const filePath = path.join(__dirname, '/temp/') + const files = [] + fs.readdirSync(filePath).forEach(async (file) => { + files.push(`${filePath}${file}`) + }) + let totalSum = 0 + for (let j = 0; j < files.length; j++) { + const data = fs.readFileSync(files[j], 'utf-8') + const rcrmIds = JSON.parse(data) + let summary = 0 + for (let i = 0; i < rcrmIds.length; i++) { + const jbs = await Job.findAll({ + where: { externalId: rcrmIds[i] } + }) + for (let j = 0; j < jbs.length; j++) { + if (jbs[j]) { + const oldStatus = jbs[j].rcrmStatus + const updated = await jbs[j].update({ rcrmStatus: null }) + summary++ + totalSum++ + logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.status}` }) + } + } + }; + logger.info({ component: `${currentStep} Sub`, message: `Updated ${summary} jobs from ${files[j]}` }) + } + logger.info({ component: currentStep, message: `Report: Totally Restored ${totalSum} jobs` }) + logger.info({ component: currentStep, message: '*************************** Restore process finished ***************************' }) +} + +restore().then(() => { + logger.info({ component: currentStep, message: 'Execution Finished!' }) + process.exit() +}).catch(err => { + logger.error(err.message) + process.exit(1) +}) diff --git a/scripts/job-rcrm-status-migration/temp/jobs-backup.json b/scripts/job-rcrm-status-migration/temp/jobs-backup.json new file mode 100644 index 00000000..fcc4b812 --- /dev/null +++ b/scripts/job-rcrm-status-migration/temp/jobs-backup.json @@ -0,0 +1 @@ +["90269852","28960960","16341500556800013350dQL","16341323722130013350Qgs","16341323715070013350yCX","16341501858830013350JSx","16342073365140013350Omh","16342071086360013350TKd","29014265","16341982292150013350DhE","16341851836400013350YSd","16341851823530013350OHa","16341323716640013350BFn","16341517864620013350LvZ","16341438759150013350CTj","16341414354520013350czx","16329389793410013350nhr","16341285133710013350gRv","16327915384700013350wjq","16322342157030013350thK","16340504449290013350Zmk","16336199677990013350hWP","16340663860380013350dkg","16323945983630013350VIn","16340663745860013350Ogp","16340521190520013350Zyo","16329256769300013350wOD","16330142450080013350Zud","16336147040350013350Nbe","16335218110630009830oSa","16328384519390013350hzK","16337227842100013350BDn","16328401153230013350dVH","16339568564580013350cxO","16337126130130013350GNX","16337229047900013350rlK","16339461887230013350pHA","16339455520130013350SMw","16292946209270013350cqL","16317343900830013350iSB","16334323145940013350bqN","16333532888560013350VfJ","16335231874280013350PsN","16335233245550013350ybF","16335365496710013350mdw","16324274043560013350per","28968572","16328235118630013350TUH","16329413634180013350cbO","89425274","16322224121530013350BxF","16335010800170013350OlD","16335010785580013350ZMW","16335010794140013350qSN","16335010771830013350kvN","16335010773590013350kyi","16329269383370013350pcK","16334453262680013350ksT","16317088129440013350Yuq","16333604284300013350scM","16334117377520013350lxQ","16334117503830013350mot","16334040093120013350uQK","16333472255660013350DMW","16322834774440013350qgN","16322398868710013350TVc","16333463496610013350hPf","16333296533550013350VMv","16311102743050013350UOQ","16305004931790013350nDf","16329484262990013350Lxj","16329780377000013350gjy","16321575158770013350aMr","16330154680980013350guh","16330154680330013350xSz","16330153298270013350azs","16317282228550013350KNM","16329976194830013350YeO","16329926004110013350tBA","16329780351410013350mLA","16305004990960013350Ssa","16325262321460013350SVA","16311098213960013350dOG","89264852","16322413567270013350DGr","16305004975190013350PFT","16309630704830013350hEg","16328129817130013350NAX","16328127653330013350DdA","16328123904580013350LUi","16328103721410013350tQw","16328099924470013350xAs","90068402","16327519095440013350Pxc","16327519083280013350ehu","16327406515900013350pkn","16324784697460013350zYO","16327120198060013350ncx","16326943991890013350CEP","27288460","16311191494770013350NUc","16313030794420013350jid","16313049677110013350DaN","16311326832280013350lHd","16323409561830013350sZU","16323378537470013350LEP","16312171350470013350JFb","16322398849240013350gPZ","16318012800890013350XTH","16323155626160013350sIH","28317595","16318000891270013350pVC","16322398874030013350dvM","29006647","16315538849780013350xOe","16310329298030013350vqT","16311345128210013350uOw","16312910846980013350yXL","16319302023020013350VjQ","16318858946340013350azO","16318858943670013350UyO","16318065232030013350ocm","16317263340200013350OAu","16318005347030013350xIY","89358414","16317823615620013350XTK","16304287461100013350mlf","16317340318160013350Tvh","90162384","16316425217580013350jtR","16317111609390013350kBm","16313011847990013350euT","16316739298570013350ubh","16316427345940013350FdR","16316254338250013350pnL","16315761396170013350NdW","16315527065980013350goJ","16315527103010013350OJR","16315527070820013350lNq","16315377284630013350kKy","16311282358380013350yvA","16311123863240013350poV","16311065501620013350xXk","16297520948230013350jsO","29381105","29121022","16297515193190013350yKq","16307003081530013350IRF","16298349408110013350fVu","16298344596880013350BkO","16306692819950013350PDG","16306692838930013350ZSc","16305973203140013350VLM","16305382326930013350ZIQ","16287824631380013350wvk","90296729","16303059379040013350mEr","16305210643780013350wHi","16298350433530013350pao","16300042451840013350bRI","28604324","29029504","29105759","16285320575270013350CGO","16292061450370013350IBs","29235622","16291317250860013350FZU","16292936844360013350FUf","28877294","90202677","90216110","90417725","29212684","29365774","16286918867350013350JMe","16285323789010013350Eaf","29205040","26759080","16297498617830013350rVR","16297359818350013350zUS","29059994","90471527","16285337043140013350ZKp","16281924024020013350syz","90148955","25996360","89385155","89371784","89518920","89505539","89438649","89398527","29373439"] \ No newline at end of file From aac522e282f0f3608f9525bbb96f96421e6db9f9 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Fri, 15 Oct 2021 10:13:04 +0800 Subject: [PATCH 07/15] reset url --- scripts/job-rcrm-status-migration/backup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/job-rcrm-status-migration/backup.js b/scripts/job-rcrm-status-migration/backup.js index 9a0f2ff5..03ef8658 100644 --- a/scripts/job-rcrm-status-migration/backup.js +++ b/scripts/job-rcrm-status-migration/backup.js @@ -15,7 +15,7 @@ async function backup () { fs.rmdirSync(filePath, { recursive: true }) } fs.mkdirSync(filePath) - let { body: jobs } = await request.get('https://www.topcoder.com/api/recruit/jobs?job_status=1&enable_job_application_form=1') + let { body: jobs } = await request.get('https://www.topcoder.com/api/recruit/jobs?job_status=1') jobs = jobs.map((item) => item.slug) if (jobs && jobs.length > 0) { try { From 7450b35ab64843e05cf05783c28c541bfb0f94c8 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Sat, 16 Oct 2021 10:06:50 +0300 Subject: [PATCH 08/15] fix local setup Kafka topics list added newline so the last topic can be read and created during local setup --- local/kafka-client/topics.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/kafka-client/topics.txt b/local/kafka-client/topics.txt index 405b2510..d83b21e1 100644 --- a/local/kafka-client/topics.txt +++ b/local/kafka-client/topics.txt @@ -21,4 +21,4 @@ taas.interview.update taas.interview.bulkUpdate external.action.email taas.action.retry -notifications.action.create \ No newline at end of file +notifications.action.create From 65c93bc65a02b294a6d9d0a400bf47150ef9defc Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 18 Oct 2021 14:52:02 +0800 Subject: [PATCH 09/15] use dev api --- scripts/job-rcrm-status-migration/backup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/job-rcrm-status-migration/backup.js b/scripts/job-rcrm-status-migration/backup.js index 03ef8658..163a3eb7 100644 --- a/scripts/job-rcrm-status-migration/backup.js +++ b/scripts/job-rcrm-status-migration/backup.js @@ -15,7 +15,7 @@ async function backup () { fs.rmdirSync(filePath, { recursive: true }) } fs.mkdirSync(filePath) - let { body: jobs } = await request.get('https://www.topcoder.com/api/recruit/jobs?job_status=1') + let { body: jobs } = await request.get('https://www.topcoder-dev.com/api/recruit/jobs?job_status=1') jobs = jobs.map((item) => item.slug) if (jobs && jobs.length > 0) { try { From 474fde4e11d05148d8f623764dace088655add5f Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 18 Oct 2021 15:00:17 +0800 Subject: [PATCH 10/15] restore ci --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37a30584..b91a021d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,6 @@ workflows: branches: only: - dev - - gigs-listing-rcrmstatus # Production builds are exectuted only on tagged commits to the # master branch. From 2384e6689fa711e81fd375beb9dbd6a29933a440 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 18 Oct 2021 15:52:49 +0800 Subject: [PATCH 11/15] allow rcrm reason to be empty --- src/services/JobService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/JobService.js b/src/services/JobService.js index c4ebd60c..f7b6aecd 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -237,7 +237,7 @@ createJob.schema = Joi.object() hotListExcerpt: Joi.stringAllowEmpty().default(''), jobTag: Joi.jobTag().default(''), rcrmStatus: Joi.jobRcrmStatus().default('Open'), - rcrmReason: Joi.string().allow(null).default(null) + rcrmReason: Joi.stringAllowEmpty().allow(null).default(null) }) .required(), onTeamCreating: Joi.boolean().default(false) @@ -339,7 +339,7 @@ partiallyUpdateJob.schema = Joi.object() hotListExcerpt: Joi.stringAllowEmpty(), jobTag: Joi.jobTag(), rcrmStatus: Joi.jobRcrmStatus(), - rcrmReason: Joi.string().allow(null) + rcrmReason: Joi.stringAllowEmpty().allow(null) }) .required() }) @@ -385,7 +385,7 @@ fullyUpdateJob.schema = Joi.object().keys({ hotListExcerpt: Joi.stringAllowEmpty().default(''), jobTag: Joi.jobTag().default(''), rcrmStatus: Joi.jobRcrmStatus().default(null), - rcrmReason: Joi.string().allow(null).default(null) + rcrmReason: Joi.stringAllowEmpty().allow(null).default(null) }).required() }).required() From 7770fc7649402ba7559359cc39bf79dd6522e6e4 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 18 Oct 2021 16:45:40 +0800 Subject: [PATCH 12/15] correct rcrm migration log (#574) --- scripts/job-rcrm-status-migration/migration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/job-rcrm-status-migration/migration.js b/scripts/job-rcrm-status-migration/migration.js index 23236f13..3b9489d3 100644 --- a/scripts/job-rcrm-status-migration/migration.js +++ b/scripts/job-rcrm-status-migration/migration.js @@ -30,7 +30,7 @@ async function migration () { const updated = await jbs[j].update({ rcrmStatus: 'Open' }) summary++ totalSum++ - logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.status}` }) + logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.rcrmStatus}` }) } } }; From 3a938d5a54717fbd003c226480cdeca5f5b69fcb Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Tue, 19 Oct 2021 00:33:09 +0800 Subject: [PATCH 13/15] correct rcrm restore log (#578) * correct rcrm migration log * correct rcrm restore log --- scripts/job-rcrm-status-migration/restore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/job-rcrm-status-migration/restore.js b/scripts/job-rcrm-status-migration/restore.js index 29a88bda..50a90e33 100644 --- a/scripts/job-rcrm-status-migration/restore.js +++ b/scripts/job-rcrm-status-migration/restore.js @@ -30,7 +30,7 @@ async function restore () { const updated = await jbs[j].update({ rcrmStatus: null }) summary++ totalSum++ - logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.status}` }) + logger.info({ component: currentStep, message: `job with rcrmId ${rcrmIds[i]} status changed from ${oldStatus} to ${updated.rcrmStatus}` }) } } }; From 52ec2b8b2bdb8a580ecb510407a70ee1ab5f1483 Mon Sep 17 00:00:00 2001 From: yoution Date: Thu, 21 Oct 2021 11:04:54 +0800 Subject: [PATCH 14/15] fix: issue topcoder-platform/taas-app#516 --- src/services/TeamService.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/TeamService.js b/src/services/TeamService.js index 0a70c1ce..a02a3a83 100644 --- a/src/services/TeamService.js +++ b/src/services/TeamService.js @@ -1136,7 +1136,13 @@ async function _validateRoleSearchRequests (roleSearchRequestIds) { } if (!roleSearchRequest.jobDescription) { roleSearchRequests[roleSearchRequestId].jobDescription = role.description + // search from skill list + if (!roleSearchRequests[roleSearchRequestId].jobDescription) { + const skills = await getSkillNamesByIds(roleSearchRequest.skills) + roleSearchRequests[roleSearchRequestId].jobDescription = skills.join(',') + } } + roleSearchRequests[roleSearchRequestId].resourceType = role.name })) return roleSearchRequests From a5f3a4c4b3fd32c6c233b9dcb066fe1f95e62265 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Thu, 21 Oct 2021 15:19:36 +0300 Subject: [PATCH 15/15] add space between skills in job descrption --- src/services/TeamService.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/TeamService.js b/src/services/TeamService.js index a02a3a83..50cb2107 100644 --- a/src/services/TeamService.js +++ b/src/services/TeamService.js @@ -1139,7 +1139,7 @@ async function _validateRoleSearchRequests (roleSearchRequestIds) { // search from skill list if (!roleSearchRequests[roleSearchRequestId].jobDescription) { const skills = await getSkillNamesByIds(roleSearchRequest.skills) - roleSearchRequests[roleSearchRequestId].jobDescription = skills.join(',') + roleSearchRequests[roleSearchRequestId].jobDescription = skills.join(', ') } }