From 328d9ec78aee2b6261d2d741f39748614317124c Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sun, 10 Oct 2021 00:04:56 +0800 Subject: [PATCH 1/5] special job false --- src/services/JobService.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/services/JobService.js b/src/services/JobService.js index b5851c00..03b4b231 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -532,7 +532,22 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false } } } } else { - return true + must = { + bool: { + must: [ + { + term: { + featured: value + } + }, + { + term: { + showInHotList: value + } + } + ] + } + } } } else { must = { From 8ef6f8309ad448e4d032689a9949568b5c7127e8 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sun, 10 Oct 2021 00:31:16 +0800 Subject: [PATCH 2/5] db special false --- src/services/JobService.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/JobService.js b/src/services/JobService.js index 681a5327..4b580dc9 100644 --- a/src/services/JobService.js +++ b/src/services/JobService.js @@ -689,6 +689,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), From f866247b2548c556dd29459f8ac07f808cc1c896 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sun, 10 Oct 2021 12:43:44 +0800 Subject: [PATCH 3/5] ci:deploying --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b91a021d..a1226abf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,6 +68,7 @@ workflows: branches: only: - dev + - gigs-listing-special-false # Production builds are exectuted only on tagged commits to the # master branch. From cb7c639a379eb8fc410e6c79b9a33e6856348bd9 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Tue, 12 Oct 2021 18:54:25 +0800 Subject: [PATCH 4/5] support featured search --- data/demo-data.json | 1 + docs/swagger.yaml | 6 ++++++ src/services/JobService.js | 9 ++++++--- 3 files changed, 13 insertions(+), 3 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 4b580dc9..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') { @@ -616,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 }) }) @@ -739,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 570d67514e9f51097f78a06bb35ba029892996b2 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Wed, 13 Oct 2021 14:36:11 +0800 Subject: [PATCH 5/5] restore ci --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1226abf..b91a021d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,6 @@ workflows: branches: only: - dev - - gigs-listing-special-false # Production builds are exectuted only on tagged commits to the # master branch.