Skip to content
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 @@ -68,6 +68,7 @@ workflows:
branches:
only:
- dev
- change-validatations-in-job-jc

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ paths:
required: false
schema:
type: string
enum: ["hourly", "daily", "weekly", "monthly"]
enum: ["hourly", "daily", "weekly", "monthly","annual"]
description: The rate type.
- in: query
name: status
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const allowedXAITemplate = _.keys(Interviews.XaiTemplate)

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')
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.workload = () => Joi.string().valid('full-time', 'fractional')
Expand Down
4 changes: 2 additions & 2 deletions src/services/JobCandidateService.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ fullyUpdateJobCandidate.schema = Joi.object().keys({
userId: Joi.string().uuid().required(),
status: Joi.jobCandidateStatus().default('open'),
externalId: Joi.string().allow(null).default(null),
resume: Joi.string().uri().allow(null).default(null),
remark: Joi.string().allow(null).default(null)
resume: Joi.string().uri().allow('').allow(null).default(null),
remark: Joi.string().allow('').allow(null).default(null)
Comment on lines +206 to +207
Copy link
Contributor

Choose a reason for hiding this comment

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

@sushilshinde we also have a reusable rule stringAllowEmpty https://github.com/topcoder-platform/taas-apis/blob/dev/src/bootstrap.js#L26 which could be reused here for consistency.

}).required()
}).required()

Expand Down
54 changes: 29 additions & 25 deletions src/services/JobService.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,31 +187,35 @@ async function createJob (currentUser, job) {
return created.toJSON()
}

createJob.schema = Joi.object().keys({
currentUser: Joi.object().required(),
job: Joi.object().keys({
status: Joi.jobStatus().default('sourcing'),
projectId: Joi.number().integer().required(),
externalId: Joi.string().allow(null),
description: Joi.stringAllowEmpty().allow(null),
title: Joi.title().required(),
startDate: Joi.date().allow(null),
duration: Joi.number().integer().min(1).allow(null),
numPositions: Joi.number().integer().min(1).required(),
resourceType: Joi.stringAllowEmpty().allow(null),
rateType: Joi.rateType().allow(null),
workload: Joi.workload().allow(null),
skills: Joi.array().items(Joi.string().uuid()).required(),
isApplicationPageActive: Joi.boolean(),
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),
roleIds: Joi.array().items(Joi.string().uuid().required())
}).required()
}).required()
createJob.schema = Joi.object()
.keys({
currentUser: Joi.object().required(),
job: Joi.object()
.keys({
status: Joi.jobStatus().default("sourcing"),
projectId: Joi.number().integer().required(),
externalId: Joi.string().allow(null),
description: Joi.stringAllowEmpty().allow(null),
title: Joi.title().required(),
startDate: Joi.date().allow(null),
duration: Joi.number().integer().min(1).allow(null),
numPositions: Joi.number().integer().min(1).required(),
resourceType: Joi.stringAllowEmpty().allow(null),
rateType: Joi.rateType().allow(null),
workload: Joi.workload().allow(null),
skills: Joi.array().items(Joi.string().uuid()).required(),
isApplicationPageActive: Joi.boolean(),
minSalary: Joi.number().integer().allow(null),
maxSalary: Joi.number().integer().allow(null),
hoursPerWeek: Joi.number().integer().allow(null),
jobLocation: Joi.string().allow(null).allow(''),
jobTimezone: Joi.string().allow(null).allow(''),
currency: Joi.string().allow(null).allow(''),
Comment on lines +211 to +213
Copy link
Contributor

Choose a reason for hiding this comment

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

@sushilshinde same here.

roleIds: Joi.array().items(Joi.string().uuid().required()),
})
.required(),
})
.required();

/**
* Update job. Normal user can only update the job he/she created.
Expand Down