Skip to content

Commit 9d49bb5

Browse files
author
James Cori
committed
Updating JOI and Markup
1 parent 0d2ab5b commit 9d49bb5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/services/ChallengeService.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,7 @@ async function createChallenge (currentUser, challenge) {
914914
const { billingAccountId, markup } = await helper.getProjectBillingInformation(_.get(challenge, 'projectId'))
915915
if (billingAccountId && _.isUndefined(_.get(challenge, 'billing.billingAccountId'))) {
916916
_.set(challenge, 'billing.billingAccountId', billingAccountId)
917-
}
918-
if (markup && _.isUndefined(_.get(challenge, 'billing.markup'))) {
919-
_.set(challenge, 'billing.markup', markup)
917+
_.set(challenge, 'billing.markup', markup || 0)
920918
}
921919
if (_.get(type, 'isTask')) {
922920
_.set(challenge, 'task.isTask', true)
@@ -1108,7 +1106,7 @@ createChallenge.schema = {
11081106
value: Joi.number().min(0).required()
11091107
})).min(1).required()
11101108
})),
1111-
tags: Joi.array().items(Joi.string().required()), // tag names
1109+
tags: Joi.array().items(Joi.string()), // tag names
11121110
projectId: Joi.number().integer().positive().required(),
11131111
legacyId: Joi.number().integer().positive(),
11141112
startDate: Joi.date(),
@@ -1294,9 +1292,7 @@ async function update (currentUser, challengeId, data, isFull) {
12941292
const { billingAccountId, markup } = await helper.getProjectBillingInformation(_.get(challenge, 'projectId'))
12951293
if (billingAccountId && _.isUndefined(_.get(challenge, 'billing.billingAccountId'))) {
12961294
_.set(data, 'billing.billingAccountId', billingAccountId)
1297-
}
1298-
if (markup && _.isUndefined(_.get(challenge, 'billing.markup'))) {
1299-
_.set(data, 'billing.markup', markup)
1295+
_.set(data, 'billing.markup', markup || 0)
13001296
}
13011297
if (data.status) {
13021298
if (data.status === constants.challengeStatuses.Active) {
@@ -1895,7 +1891,7 @@ fullyUpdateChallenge.schema = {
18951891
url: Joi.string(),
18961892
options: Joi.array().items(Joi.object())
18971893
})),
1898-
tags: Joi.array().items(Joi.string().required()), // tag names
1894+
tags: Joi.array().items(Joi.string()), // tag names
18991895
projectId: Joi.number().integer().positive().required(),
19001896
legacyId: Joi.number().integer().positive(),
19011897
startDate: Joi.date(),

0 commit comments

Comments
 (0)