Skip to content

Commit d8144bc

Browse files
Fix joi
1 parent 64fe5f1 commit d8144bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/services/ChallengeService.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ function sanitizeChallenge (challenge) {
16681668
sanitized.terms = _.map(challenge.terms, term => _.pick(term, ['id', 'roleId']))
16691669
}
16701670
if (challenge.attachments) {
1671-
sanitized.attachments = _.map(challenge.attachments, attachment => _.pick(attachment, ['id', 'name', 'url', 'fileSize', 'description']))
1671+
sanitized.attachments = _.map(challenge.attachments, attachment => _.pick(attachment, ['id', 'name', 'url', 'fileSize', 'description', 'challengeId']))
16721672
}
16731673
return sanitized
16741674
}
@@ -1746,6 +1746,8 @@ fullyUpdateChallenge.schema = {
17461746
startDate: Joi.date(),
17471747
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
17481748
attachments: Joi.array().items(Joi.object().keys({
1749+
id: Joi.id(),
1750+
challengeId: Joi.id(),
17491751
name: Joi.string().required(),
17501752
url: Joi.string().uri().required(),
17511753
fileSize: Joi.fileSize(),
@@ -1840,6 +1842,8 @@ partiallyUpdateChallenge.schema = {
18401842
legacyId: Joi.number().integer().positive(),
18411843
status: Joi.string().valid(_.values(constants.challengeStatuses)),
18421844
attachments: Joi.array().items(Joi.object().keys({
1845+
id: Joi.id(),
1846+
challengeId: Joi.id(),
18431847
name: Joi.string().required(),
18441848
url: Joi.string().uri().required(),
18451849
fileSize: Joi.fileSize(),

0 commit comments

Comments
 (0)