Skip to content

Commit 7d5349d

Browse files
api update
1 parent 92355a3 commit 7d5349d

File tree

4 files changed

+79
-7
lines changed

4 files changed

+79
-7
lines changed

docs/swagger.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ paths:
219219
schema:
220220
type: boolean
221221
description: The featured jobs
222+
- in: query
223+
name: rcrmStatus
224+
required: false
225+
schema:
226+
type: string
227+
enum: ["Open", "On Hold", "Canceled", "Draft", "Closed"]
222228
requestBody:
223229
content:
224230
application/json:
@@ -4128,6 +4134,32 @@ components:
41284134
type: string
41294135
example: "USD"
41304136
description: "the currency of job"
4137+
showInHotList:
4138+
type: boolean
4139+
default: false
4140+
description: "Whether to show job in hot list"
4141+
featured:
4142+
type: boolean
4143+
default: false
4144+
description: "Whether a job is a featured job"
4145+
hotListExcerpt:
4146+
type: string
4147+
default: ''
4148+
description: "A text to show for the hotlist excerpt"
4149+
jobTag:
4150+
type: string
4151+
default: ''
4152+
enum: ["New", "$$$", "Hot", ""]
4153+
description: "the job tag"
4154+
rcrmStatus:
4155+
type: string
4156+
default: null
4157+
enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"]
4158+
description: "the job rcrm status"
4159+
rcrmReason:
4160+
type: string
4161+
default: null
4162+
description: "the possible rcrm reason for current status"
41314163
createdAt:
41324164
type: string
41334165
format: date-time
@@ -4247,6 +4279,15 @@ components:
42474279
type: string
42484280
enum: ["", "New", "$$$", "Hot"]
42494281
description: "The tag of a job"
4282+
rcrmStatus:
4283+
type: string
4284+
default: null
4285+
enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"]
4286+
description: "the job rcrm status"
4287+
rcrmReason:
4288+
type: string
4289+
default: null
4290+
description: "the possible rcrm reason for current status"
42504291
isApplicationPageActive:
42514292
type: boolean
42524293
default: false
@@ -4803,6 +4844,15 @@ components:
48034844
type: string
48044845
enum: ["", "New", "$$$", "Hot"]
48054846
description: "The tag of a job"
4847+
rcrmStatus:
4848+
type: string
4849+
default: null
4850+
enum: [null, "Open", "On Hold", "Canceled", "Draft", "Closed"]
4851+
description: "the job rcrm status"
4852+
rcrmReason:
4853+
type: string
4854+
default: null
4855+
description: "the possible rcrm reason for current status"
48064856
isApplicationPageActive:
48074857
type: boolean
48084858
default: false

src/bootstrap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Joi.page = () => Joi.number().integer().min(1).default(1)
1313
Joi.perPage = () => Joi.number().integer().min(1).default(20)
1414
Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly', 'annual')
1515
Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled')
16+
Joi.jobRcrmStatus = () => Joi.string().valid('Open', 'On Hold', 'Canceled', 'Draft', 'Closed').allow(null)
1617
Joi.jobTag = () => Joi.string().valid('New', '$$$', 'Hot').allow('')
1718
Joi.resourceBookingStatus = () => Joi.string().valid('placed', 'closed', 'cancelled')
1819
Joi.workload = () => Joi.string().valid('full-time', 'fractional')

src/models/Job.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ module.exports = (sequelize) => {
164164
allowNull: true,
165165
defaultValue: ''
166166
},
167+
rcrmStatus: {
168+
field: 'rcrm_status',
169+
type: Sequelize.STRING(255),
170+
allowNull: true,
171+
defaultValue: null
172+
},
173+
rcrmReason: {
174+
field: 'rcrm_reason',
175+
type: Sequelize.STRING(255),
176+
allowNull: true,
177+
defaultValue: null
178+
},
167179
createdBy: {
168180
field: 'created_by',
169181
type: Sequelize.UUID,

src/services/JobService.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ createJob.schema = Joi.object()
235235
showInHotList: Joi.boolean().default(false),
236236
featured: Joi.boolean().default(false),
237237
hotListExcerpt: Joi.stringAllowEmpty().default(''),
238-
jobTag: Joi.jobTag().default('')
238+
jobTag: Joi.jobTag().default(''),
239+
rcrmStatus: Joi.jobRcrmStatus().default('Open'),
240+
rcrmReason: Joi.string().allow(null).default(null)
239241
})
240242
.required(),
241243
onTeamCreating: Joi.boolean().default(false)
@@ -335,7 +337,9 @@ partiallyUpdateJob.schema = Joi.object()
335337
showInHotList: Joi.boolean(),
336338
featured: Joi.boolean(),
337339
hotListExcerpt: Joi.stringAllowEmpty(),
338-
jobTag: Joi.jobTag()
340+
jobTag: Joi.jobTag(),
341+
rcrmStatus: Joi.jobRcrmStatus(),
342+
rcrmReason: Joi.string().allow(null)
339343
})
340344
.required()
341345
})
@@ -379,7 +383,9 @@ fullyUpdateJob.schema = Joi.object().keys({
379383
showInHotList: Joi.boolean().default(false),
380384
featured: Joi.boolean().default(false),
381385
hotListExcerpt: Joi.stringAllowEmpty().default(''),
382-
jobTag: Joi.jobTag().default('')
386+
jobTag: Joi.jobTag().default(''),
387+
rcrmStatus: Joi.jobRcrmStatus().default(null),
388+
rcrmReason: Joi.string().allow(null).default(null)
383389
}).required()
384390
}).required()
385391

@@ -482,10 +488,11 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
482488
'maxSalary',
483489
'jobLocation',
484490
'specialJob',
485-
'featured'
491+
'featured',
492+
'rcrmStatus'
486493
]), (value, key) => {
487494
let must
488-
if (key === 'description' || key === 'title') {
495+
if (key === 'description' || key === 'title' || key === 'rcrmStatus') {
489496
must = {
490497
match: {
491498
[key]: {
@@ -618,7 +625,8 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
618625
'rateType',
619626
'workload',
620627
'status',
621-
'featured'
628+
'featured',
629+
'rcrmStatus'
622630
]), (value, key) => {
623631
filter[Op.and].push({ [key]: value })
624632
})
@@ -742,7 +750,8 @@ searchJobs.schema = Joi.object().keys({
742750
maxSalary: Joi.number().integer(),
743751
jobLocation: Joi.string(),
744752
specialJob: Joi.boolean(),
745-
featured: Joi.boolean()
753+
featured: Joi.boolean(),
754+
rcrmStatus: Joi.string().valid('Open', 'On Hold', 'Canceled', 'Draft', 'Closed')
746755
}).required(),
747756
options: Joi.object()
748757
}).required()

0 commit comments

Comments
 (0)