Skip to content

Change validatations in job and JC #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ workflows:
only:
- dev
- dev-circleci
- change-validatations-in-job-j

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const allowedInterviewStatuses = _.values(Interview.Status)

global.Promise = require('bluebird')

Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly')
Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly','annual')
Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled')
Joi.resourceBookingStatus = () => Joi.string().valid('placed', 'closed', 'cancelled')
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')
Expand Down
46 changes: 25 additions & 21 deletions src/services/JobCandidateProcessorService.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,31 @@ async function processCreate (message, transactionId) {
}

processCreate.schema = {
message: Joi.object().keys({
topic: Joi.string().required(),
originator: Joi.string().required(),
timestamp: Joi.date().required(),
'mime-type': Joi.string().required(),
payload: Joi.object().keys({
id: Joi.string().uuid().required(),
jobId: Joi.string().uuid().required(),
userId: Joi.string().uuid().required(),
createdAt: Joi.date().required(),
createdBy: Joi.string().uuid().required(),
updatedAt: Joi.date().allow(null),
updatedBy: Joi.string().uuid().allow(null),
status: Joi.jobCandidateStatus().required(),
externalId: Joi.string().allow(null),
resume: Joi.string().uri().allow(null),
remark: Joi.string().allow(null)
}).required()
}).required(),
transactionId: Joi.string().required()
}
message: Joi.object()
.keys({
topic: Joi.string().required(),
originator: Joi.string().required(),
timestamp: Joi.date().required(),
"mime-type": Joi.string().required(),
payload: Joi.object()
.keys({
id: Joi.string().uuid().required(),
jobId: Joi.string().uuid().required(),
userId: Joi.string().uuid().required(),
createdAt: Joi.date().required(),
createdBy: Joi.string().uuid().required(),
updatedAt: Joi.date().allow(null),
updatedBy: Joi.string().uuid().allow(null),
status: Joi.jobCandidateStatus().required(),
externalId: Joi.string().allow(null),
resume: Joi.string().uri().allow(null).allow(''),
remark: Joi.string().allow(null).allow('')
})
.required(),
})
.required(),
transactionId: Joi.string().required(),
};

/**
* Process update entity message
Expand Down
6 changes: 3 additions & 3 deletions src/services/JobProcessorService.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ processCreate.schema = {
minSalary: Joi.number().integer().allow(null),
maxSalary: Joi.number().integer().allow(null),
hoursPerWeek: Joi.number().integer().allow(null),
jobLocation: Joi.string().allow(null),
jobTimezone: Joi.string().allow(null),
currency: Joi.string().allow(null),
jobLocation: Joi.string().allow(null).allow(''),
jobTimezone: Joi.string().allow(null).allow(''),
currency: Joi.string().allow(null).allow(''),
Comment on lines +91 to +93
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sushilshinde This is fine, but we also have Joi.stringAllowEmpty rule defined here https://github.com/topcoder-platform/taas-es-processor/blob/dev/src/bootstrap.js#L25 which can be reused for consistency.

roleIds: Joi.array().items(Joi.string().uuid().required()).allow(null)
}).required()
}).required(),
Expand Down