Skip to content

Commit 85c11b2

Browse files
authored
Merge pull request #648 from topcoder-platform/feature/PLAT3368
add JOI validation for constraint allowedRegistrants
2 parents 6081ffb + 8342ab7 commit 85c11b2

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"dependencies": {
4343
"@grpc/grpc-js": "^1.8.12",
4444
"@opensearch-project/opensearch": "^2.2.0",
45-
"@topcoder-framework/domain-challenge": "^0.18.0",
46-
"@topcoder-framework/lib-common": "^0.18.0",
45+
"@topcoder-framework/domain-challenge": "^0.22.0",
46+
"@topcoder-framework/lib-common": "^0.22.0",
4747
"aws-sdk": "^2.1145.0",
4848
"axios": "^0.19.0",
4949
"axios-retry": "^3.4.0",

src/common/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ async function capturePayment(paymentId) {
358358
const url = `${config.CUSTOMER_PAYMENTS_URL}/${paymentId}/charge`;
359359
logger.info(`Calling: ${url} to capture payment`);
360360
const res = await axios.patch(url, {}, { headers: { Authorization: `Bearer ${token}` } });
361-
logger.debug(`Payment API Response: ${JSON.stringify(res.data, null, 2)}`);
361+
logger.debug(`Payment API Response: ${JSON.stringify(res.data)}`);
362362
if (res.data.status !== "succeeded") {
363363
throw new Error(`Failed to charge payment. Current status: ${res.data.status}`);
364364
}

src/phase-management/PhaseAdvancer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class PhaseAdvancer {
212212
this.#updateSubsequentPhases(phases, phase, -delta);
213213
}
214214

215-
console.log(`Updated phases: ${JSON.stringify(phases, null, 2)}`);
215+
console.log(`Updated phases: ${JSON.stringify(phases)}`);
216216
}
217217

218218
async #close(challengeId, phases, phase) {
@@ -229,7 +229,7 @@ class PhaseAdvancer {
229229
this.#updateSubsequentPhases(phases, phase, -delta);
230230
}
231231

232-
console.log(`Updated phases: ${JSON.stringify(phases, null, 2)}`);
232+
console.log(`Updated phases: ${JSON.stringify(phases)}`);
233233
}
234234

235235
#insertPhaseIfRequired(phases, phase, facts) {
@@ -326,9 +326,7 @@ class PhaseAdvancer {
326326
async #hasActiveUnreviewedSubmissions(challengeId, phaseSpecificFacts, phases) {
327327
console.log(
328328
`Checking if there are active unreviewed submissions for challenge ${challengeId} using phaseSpecificFacts: ${JSON.stringify(
329-
phaseSpecificFacts,
330-
null,
331-
2
329+
phaseSpecificFacts
332330
)}`
333331
);
334332

src/services/ChallengeService.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,9 @@ createChallenge.schema = {
11651165
tags: Joi.array().items(Joi.string()), // tag names
11661166
projectId: Joi.number().integer().positive(),
11671167
legacyId: Joi.number().integer().positive(),
1168+
constraints: Joi.object().keys({
1169+
allowedRegistrants: Joi.array().items(Joi.string()).optional()
1170+
}).optional(),
11681171
startDate: Joi.date().iso(),
11691172
status: Joi.string().valid([
11701173
constants.challengeStatuses.Active,
@@ -1991,6 +1994,9 @@ updateChallenge.schema = {
19911994
tags: Joi.array().items(Joi.string().required()).min(1), // tag names
19921995
projectId: Joi.number().integer().positive(),
19931996
legacyId: Joi.number().integer().positive(),
1997+
constraints: Joi.object().keys({
1998+
allowedRegistrants: Joi.array().items(Joi.string()).optional()
1999+
}).optional(),
19942000
status: Joi.string().valid(_.values(constants.challengeStatuses)),
19952001
attachments: Joi.array().items(
19962002
Joi.object().keys({

yarn.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -255,35 +255,35 @@
255255
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
256256
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
257257

258-
"@topcoder-framework/client-relational@^0.18.0":
259-
version "0.18.0"
260-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/client-relational/-/client-relational-0.18.0.tgz#20175617c3ac281797d7717a157159076b2578fb"
261-
integrity sha512-JwcKcuT6w/3ydd27+doi9dVWHtuJClXOwajVOfXfHPGFhsgswfoFZ+k4kfc2kC/fioDJ1IPKdFRTeVCxycljnA==
258+
"@topcoder-framework/client-relational@^0.22.0":
259+
version "0.22.0"
260+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/client-relational/-/client-relational-0.22.0.tgz#0e096758ffd8c9d0eb986b2f9328ed247930abfe"
261+
integrity sha512-We0sb8pdxOZfzX8WzKxczhXl16jmZ6cN/eBgDv5jR8qpVoXhLTa2iaTLqiRYUWi9ZvHCN6vmNQ607w0IU/iRFQ==
262262
dependencies:
263263
"@grpc/grpc-js" "^1.8.0"
264-
"@topcoder-framework/lib-common" "^0.18.0"
265-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-1"
264+
"@topcoder-framework/lib-common" "^0.22.0"
265+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
266266
tslib "^2.4.1"
267267

268-
"@topcoder-framework/domain-challenge@^0.18.0":
269-
version "0.18.0"
270-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/domain-challenge/-/domain-challenge-0.18.0.tgz#505d24e14a0354c900c2d55f92335bf9c5aa8d8c"
271-
integrity sha512-+jPNhU+ZqcTjuPBCYc2mLLTUiKVg1WTUZbaySL09iYoEQpnfhpCf/t3Z/5cnC2WuLlaHp5lR7xQP5+Iz/Hl+6g==
268+
"@topcoder-framework/domain-challenge@^0.22.0":
269+
version "0.22.0"
270+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/domain-challenge/-/domain-challenge-0.22.0.tgz#bcb7f7a602e424d9932fd0693935aa5f1f2439a4"
271+
integrity sha512-PT2Zts56QKtntSJQxjH8slRjrYISuUGCZdYmyQcy+ak0nQL0COhQ0puqJ6mfIA9Ml3Ggi8Vmk/G9Ti12h1YNDg==
272272
dependencies:
273273
"@grpc/grpc-js" "^1.8.0"
274-
"@topcoder-framework/client-relational" "^0.18.0"
275-
"@topcoder-framework/lib-common" "^0.18.0"
276-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-1"
274+
"@topcoder-framework/client-relational" "^0.22.0"
275+
"@topcoder-framework/lib-common" "^0.22.0"
276+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
277277
tslib "^2.4.1"
278278

279-
"@topcoder-framework/lib-common@^0.18.0":
280-
version "0.18.0"
281-
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/lib-common/-/lib-common-0.18.0.tgz#ad06f5effbebcb67472cd0c51434ae4415fd9ba1"
282-
integrity sha512-961jxIjgQcSlMfhQCM9bi8A4yjQV88hzAhOM/SO5k40WhnsmiazWwb4+P9asoBie86Z2TpYn1cnP0hNt1IQ3DA==
279+
"@topcoder-framework/lib-common@^0.22.0":
280+
version "0.22.0"
281+
resolved "https://topcoder-409275337247.d.codeartifact.us-east-1.amazonaws.com/npm/topcoder-framework/@topcoder-framework/lib-common/-/lib-common-0.22.0.tgz#bd3428b0199410a5151326d1d9731c404c255fb5"
282+
integrity sha512-sHdOAyCGcNaDT9esc9Q3sNaqvVAwHPv6NCTlTAt5O9dcSpdz2AyEur8mS5WccFclKhF5ZB9BM1bbWxO8i9WXGQ==
283283
dependencies:
284284
"@grpc/grpc-js" "^1.8.0"
285285
rimraf "^3.0.2"
286-
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.56-beta-1"
286+
topcoder-interface "github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1"
287287
tslib "^2.4.1"
288288

289289
"@types/body-parser@*":
@@ -3999,9 +3999,9 @@ topcoder-bus-api-wrapper@topcoder-platform/tc-bus-api-wrapper.git:
39993999
superagent "^3.8.3"
40004000
tc-core-library-js appirio-tech/tc-core-library-js.git#v2.6.4
40014001

4002-
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.56-beta-1":
4002+
"topcoder-interface@github:topcoder-platform/plat-interface-definition#v0.0.58-beta-1":
40034003
version "1.0.0"
4004-
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/7d743db08b113964d5cd3d52644963af7dde5ba4"
4004+
resolved "https://codeload.github.com/topcoder-platform/plat-interface-definition/tar.gz/474bcfa1d01f0f2d0a2658de21aa835f4c824c44"
40054005

40064006
topo@3.x.x:
40074007
version "3.0.3"

0 commit comments

Comments
 (0)