Skip to content

Commit 8782f0e

Browse files
committed
fix: allow memberId to be a number
Signed-off-by: Rakib Ansary <[email protected]>
1 parent e70465e commit 8782f0e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/services/ChallengeService.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ async function updateChallenge(currentUser, challengeId, data) {
18261826
}
18271827

18281828
if (!_.isUndefined(data.terms)) {
1829-
await helper.validateChallengeTerms(data.terms);
1829+
await helper.validateChallengeTerms(data.terms.map((t) => t.id));
18301830
}
18311831

18321832
if (data.phases && data.phases.length > 0) {
@@ -1968,7 +1968,7 @@ updateChallenge.schema = {
19681968
task: Joi.object().keys({
19691969
isTask: Joi.boolean().default(false),
19701970
isAssigned: Joi.boolean().default(false),
1971-
memberId: Joi.string().allow(null),
1971+
memberId: Joi.alternatives().try(Joi.string().allow(null), Joi.number().allow(null)),
19721972
}),
19731973
billing: Joi.object()
19741974
.keys({
@@ -2070,7 +2070,7 @@ updateChallenge.schema = {
20702070
description: Joi.string(),
20712071
})
20722072
),
2073-
groups: Joi.array().items(Joi.id()), // group names
2073+
groups: Joi.array().items(Joi.optionalId()).unique(),
20742074
// gitRepoURLs: Joi.array().items(Joi.string().uri()),
20752075
winners: Joi.array()
20762076
.items(
@@ -2086,7 +2086,12 @@ updateChallenge.schema = {
20862086
.unknown(true)
20872087
)
20882088
.min(1),
2089-
terms: Joi.array().items(Joi.id().optional()).optional().allow([]),
2089+
terms: Joi.array().items(
2090+
Joi.object().keys({
2091+
id: Joi.id(),
2092+
roleId: Joi.id(),
2093+
})
2094+
),
20902095
overview: Joi.any().forbidden(),
20912096
})
20922097
.unknown(true)

0 commit comments

Comments
 (0)