Skip to content

Commit 2464374

Browse files
Merge branch 'gigs-job-model' into gigs-change-aggs
2 parents 9d55d12 + b0d2c2f commit 2464374

File tree

5 files changed

+113
-3
lines changed

5 files changed

+113
-3
lines changed

docs/swagger.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,6 +4221,20 @@ components:
42214221
type: string
42224222
format: uuid
42234223
description: "The role id."
4224+
showInHotList:
4225+
type: boolean
4226+
default: false
4227+
featured:
4228+
type: boolean
4229+
default: false
4230+
hotListExcerpt:
4231+
type: string
4232+
example: "This is very hot job"
4233+
description: "The further instruction to show for the hot job"
4234+
jobTag:
4235+
type: string
4236+
enum: ["", "new", "dollor", "hot"]
4237+
description: "The tag of a job"
42244238
isApplicationPageActive:
42254239
type: boolean
42264240
default: false
@@ -4763,6 +4777,20 @@ components:
47634777
type: string
47644778
format: uuid
47654779
description: "The role id."
4780+
showInHotList:
4781+
type: boolean
4782+
default: false
4783+
featured:
4784+
type: boolean
4785+
default: false
4786+
hotListExcerpt:
4787+
type: string
4788+
example: "This is very hot job"
4789+
description: "The further instruction to show for the hot job"
4790+
jobTag:
4791+
type: string
4792+
enum: ["", "new", "dollor", "hot"]
4793+
description: "The tag of a job"
47664794
isApplicationPageActive:
47674795
type: boolean
47684796
default: false
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const config = require('config')
2+
3+
/*
4+
* Add show_in_hot_list, featured, hot_list_excerpt and job_tag to the Job model.
5+
type: Sequelize.BOOLEAN,
6+
defaultValue: false,
7+
allowNull: false
8+
*/
9+
10+
module.exports = {
11+
up: async (queryInterface, Sequelize) => {
12+
const transaction = await queryInterface.sequelize.transaction()
13+
try {
14+
await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'show_in_hot_list',
15+
{ type: Sequelize.BOOLEAN, allowNull: true, defaultValue: false },
16+
{ transaction })
17+
await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'featured',
18+
{ type: Sequelize.BOOLEAN, allowNull: true, defaultValue: false },
19+
{ transaction })
20+
await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'hot_list_excerpt',
21+
{ type: Sequelize.STRING(255), allowNull: true, defaultValue: '' },
22+
{ transaction })
23+
await queryInterface.addColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'job_tag',
24+
{ type: Sequelize.STRING(30), allowNull: true, defaultValue: '' },
25+
{ transaction })
26+
await transaction.commit()
27+
} catch (err) {
28+
await transaction.rollback()
29+
throw err
30+
}
31+
},
32+
down: async (queryInterface, Sequelize) => {
33+
const transaction = await queryInterface.sequelize.transaction()
34+
try {
35+
await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'show_in_hot_list', { transaction })
36+
await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'featured', { transaction })
37+
await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'hot_list_excerpt', { transaction })
38+
await queryInterface.removeColumn({ tableName: 'jobs', schema: config.DB_SCHEMA_NAME }, 'job_tag', { transaction })
39+
await transaction.commit()
40+
} catch (err) {
41+
await transaction.rollback()
42+
throw err
43+
}
44+
}
45+
}

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.jobTag = () => Joi.string().valid('new', 'dollor', 'hot').allow('')
1617
Joi.resourceBookingStatus = () => Joi.string().valid('placed', 'closed', 'cancelled')
1718
Joi.workload = () => Joi.string().valid('full-time', 'fractional')
1819
Joi.jobCandidateStatus = () => Joi.string().valid('open', 'placed', 'selected', 'client rejected - screening', 'client rejected - interview', 'rejected - other', 'cancelled', 'interview', 'topcoder-rejected', 'applied', 'rejected-pre-screen', 'skills-test', 'skills-test', 'phone-screen', 'job-closed', 'offered', 'withdrawn', 'withdrawn-prescreen')

src/models/Job.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,30 @@ module.exports = (sequelize) => {
140140
type: Sequelize.UUID
141141
})
142142
},
143+
showInHotList: {
144+
field: 'show_in_hot_list',
145+
type: Sequelize.BOOLEAN,
146+
allowNull: true,
147+
defaultValue: false
148+
},
149+
featured: {
150+
field: 'featured',
151+
type: Sequelize.BOOLEAN,
152+
allowNull: true,
153+
defaultValue: false
154+
},
155+
hotListExcerpt: {
156+
field: 'hot_list_excerpt',
157+
type: Sequelize.STRING(255),
158+
allowNull: true,
159+
defaultValue: ''
160+
},
161+
jobTag: {
162+
field: 'job_tag',
163+
type: Sequelize.STRING(30),
164+
allowNull: true,
165+
defaultValue: ''
166+
},
143167
createdBy: {
144168
field: 'created_by',
145169
type: Sequelize.UUID,

src/services/JobService.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ createJob.schema = Joi.object()
231231
jobLocation: Joi.stringAllowEmpty().allow(null),
232232
jobTimezone: Joi.stringAllowEmpty().allow(null),
233233
currency: Joi.stringAllowEmpty().allow(null),
234-
roleIds: Joi.array().items(Joi.string().uuid().required())
234+
roleIds: Joi.array().items(Joi.string().uuid().required()),
235+
showInHotList: Joi.boolean().default(false),
236+
featured: Joi.boolean().default(false),
237+
hotListExcerpt: Joi.stringAllowEmpty().default(''),
238+
jobTag: Joi.jobTag().default('')
235239
})
236240
.required(),
237241
onTeamCreating: Joi.boolean().default(false)
@@ -327,7 +331,11 @@ partiallyUpdateJob.schema = Joi.object()
327331
jobLocation: Joi.stringAllowEmpty().allow(null),
328332
jobTimezone: Joi.stringAllowEmpty().allow(null),
329333
currency: Joi.stringAllowEmpty().allow(null),
330-
roleIds: Joi.array().items(Joi.string().uuid().required()).allow(null)
334+
roleIds: Joi.array().items(Joi.string().uuid().required()).allow(null),
335+
showInHotList: Joi.boolean().default(false),
336+
featured: Joi.boolean().default(false),
337+
hotListExcerpt: Joi.stringAllowEmpty().default(''),
338+
jobTag: Joi.jobTag().default('')
331339
})
332340
.required()
333341
})
@@ -367,7 +375,11 @@ fullyUpdateJob.schema = Joi.object().keys({
367375
jobLocation: Joi.stringAllowEmpty().allow(null),
368376
jobTimezone: Joi.stringAllowEmpty().allow(null),
369377
currency: Joi.stringAllowEmpty().allow(null),
370-
roleIds: Joi.array().items(Joi.string().uuid().required()).default(null)
378+
roleIds: Joi.array().items(Joi.string().uuid().required()).default(null),
379+
showInHotList: Joi.boolean().default(false),
380+
featured: Joi.boolean().default(false),
381+
hotListExcerpt: Joi.stringAllowEmpty().default(''),
382+
jobTag: Joi.jobTag().default('')
371383
}).required()
372384
}).required()
373385

0 commit comments

Comments
 (0)