Skip to content

Commit bcdcfb7

Browse files
Merge develop
2 parents 8cc6c63 + 5d0fb5e commit bcdcfb7

9 files changed

+70
-17
lines changed

app-constants.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const UserRoles = {
99
const prizeSetTypes = {
1010
ChallengePrizes: 'Challenge prizes',
1111
CopilotPayment: 'Copilot payment',
12-
ReviewerPayment: 'Reviewer payment'
12+
ReviewerPayment: 'Reviewer payment',
13+
CheckpointPrizes: 'Checkpoint prizes'
1314
}
1415

1516
const challengeStatuses = {
@@ -25,8 +26,8 @@ const EVENT_MIME_TYPE = 'application/json'
2526

2627
// using a testing topc, should be changed to use real topics in comments when they are created
2728
const Topics = {
28-
ChallengeCreated: 'test.new.bus.events', // 'challenge.action.created',
29-
ChallengeUpdated: 'test.new.bus.events', // 'challenge.action.updated',
29+
ChallengeCreated: 'challenge.notification.create',
30+
ChallengeUpdated: 'challenge.notification.update',
3031
ChallengeTypeCreated: 'test.new.bus.events', // 'challenge.action.type.created',
3132
ChallengeTypeUpdated: 'test.new.bus.events', // 'challenge.action.type.updated',
3233
ChallengeSettingCreated: 'test.new.bus.events', // 'challenge.action.setting.created',

docs/swagger.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,10 @@ definitions:
17391739
forumId:
17401740
type: integer
17411741
description: the forum id
1742+
startDate:
1743+
type: string
1744+
format: date-time
1745+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
17421746
status:
17431747
type: string
17441748
description: the status
@@ -1944,6 +1948,10 @@ definitions:
19441948
forumId:
19451949
type: integer
19461950
description: the forum id
1951+
startDate:
1952+
type: string
1953+
format: date-time
1954+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
19471955
status:
19481956
type: string
19491957
description: the status
@@ -2036,6 +2044,10 @@ definitions:
20362044
forumId:
20372045
type: integer
20382046
description: the forum id
2047+
startDate:
2048+
type: string
2049+
format: date-time
2050+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
20392051
status:
20402052
type: string
20412053
description: the status

docs/topcoder-challenge-api.postman_collection.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "6a28e634-7139-4084-b9eb-3318062e035c",
3+
"_postman_id": "8c95de1a-8571-4a3a-907c-077bc68ffd2c",
44
"name": "topcoder-challenge-api",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
@@ -10814,7 +10814,7 @@
1081410814
],
1081510815
"body": {
1081610816
"mode": "raw",
10817-
"raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID1}}\",\n\t\"track\": \"test-track\",\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"id\": \"{{PHASEA_ID}}\",\n \t\"name\": \"new-phase-1\",\n \t\"isActive\": true,\n \t\"duration\": 1000000\n },\n {\n \t\"id\": \"{{PHASEB_ID}}\",\n \t\"name\": \"new-PHASE-2\",\n \t\"description\": \"add-description-in-put\",\n\t \t\"predecessor\": \"{{PHASEA_ID}}\",\n \t\t\"isActive\": true,\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"reviewType\": \"review type\",\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"forumId\": 456,\n\t\"legacyId\": 123456,\n\t\"status\": \"Draft\"\n}"
10817+
"raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID1}}\",\n\t\"track\": \"test-track\",\n\t\"name\": \"test-create\",\n\t\"description\": \"test-description\",\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n\t\t{\n \t\"id\": \"{{PHASEA_ID}}\",\n \t\"name\": \"new-phase-1\",\n \t\"isActive\": true,\n \t\"duration\": 1000000\n },\n {\n \t\"id\": \"{{PHASEB_ID}}\",\n \t\"name\": \"new-PHASE-2\",\n \t\"description\": \"add-description-in-put\",\n\t \t\"predecessor\": \"{{PHASEA_ID}}\",\n \t\t\"isActive\": true,\n\t \t\"duration\": 2000000\n }\n\t],\n\t\"prizeSets\": [\n\t\t{\n\t\t\t\"type\": \"Challenge prizes\",\n\t\t\t\"description\": \"desc\",\n\t\t\t\"prizes\": [\n\t\t {\n\t\t \"description\": \"desc-first\",\n\t\t \"type\": \"first place\",\n\t\t \"value\": 500\n\t\t },\n\t\t {\n\t\t \"description\": \"desc-second\",\n\t\t \"type\": \"second place\",\n\t\t \"value\": 250\n\t\t }\n\t\t ]\n\t\t}\n\t],\n\t\"reviewType\": \"review type\",\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"forumId\": 456,\n\t\"status\": \"Draft\",\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}"
1081810818
},
1081910819
"url": {
1082010820
"raw": "{{URL}}/challenges",
@@ -10866,7 +10866,7 @@
1086610866
],
1086710867
"body": {
1086810868
"mode": "raw",
10869-
"raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID2}}\",\n\t\"track\": \"test-track-1\",\n\t\"name\": \"test-create-copilot\",\n\t\"description\": \"test-description\",\n\t\"challengeSettings\": [\n\t\t{\n\t\t\t\"type\": \"{{TEST_SETTING_ID3}}\",\n\t\t\t\"value\": \"value3\"\n\t\t},\n\t\t{\n\t\t\t\"type\": \"{{TEST_SETTING_ID4}}\",\n\t\t\t\"value\": \"value4\"\n\t\t}\n\t],\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"id\": \"{{PHASEA_ID}}\",\n \"name\": \"new-phase-1\",\n \"isActive\": true,\n \"duration\": 1000000\n },\n {\n \"id\": \"{{PHASEB_ID}}\",\n \"name\": \"new-PHASE-2\",\n \"description\": \"add-description-in-put\",\n \"predecessor\": \"{{PHASEA_ID}}\",\n \"isActive\": true,\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"reviewType\": \"review type\",\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"forumId\": 456,\n\t\"status\": \"Draft\",\n\t\"groups\": [\"group1\", \"group2\"]\n}"
10869+
"raw": "{\n\t\"typeId\": \"{{TEST_TYPE_ID2}}\",\n\t\"track\": \"test-track-1\",\n\t\"name\": \"test-create-copilot\",\n\t\"description\": \"test-description\",\n\t\"challengeSettings\": [\n\t\t{\n\t\t\t\"type\": \"{{TEST_SETTING_ID3}}\",\n\t\t\t\"value\": \"value3\"\n\t\t},\n\t\t{\n\t\t\t\"type\": \"{{TEST_SETTING_ID4}}\",\n\t\t\t\"value\": \"value4\"\n\t\t}\n\t],\n\t\"timelineTemplateId\": \"{{TEMPLATEA_ID}}\",\n\t\"phases\": [\n {\n \"id\": \"{{PHASEA_ID}}\",\n \"name\": \"new-phase-1\",\n \"isActive\": true,\n \"duration\": 1000000\n },\n {\n \"id\": \"{{PHASEB_ID}}\",\n \"name\": \"new-PHASE-2\",\n \"description\": \"add-description-in-put\",\n \"predecessor\": \"{{PHASEA_ID}}\",\n \"isActive\": true,\n \"duration\": 2000000\n }\n ],\n \"prizeSets\": [\n {\n \"type\": \"Challenge prizes\",\n \"description\": \"desc\",\n \"prizes\": [\n {\n \"description\": \"desc-first\",\n \"type\": \"first place\",\n \"value\": 500\n },\n {\n \"description\": \"desc-second\",\n \"type\": \"second place\",\n \"value\": 250\n }\n ]\n }\n ],\n\t\"reviewType\": \"review type\",\n\t\"tags\": [\"tag1\", \"tag2\"],\n\t\"projectId\": 123,\n\t\"forumId\": 456,\n\t\"status\": \"Draft\",\n\t\"groups\": [\"group1\", \"group2\"],\n\t\"startDate\": \"2019-06-22T16:28:39.882Z\"\n}"
1087010870
},
1087110871
"url": {
1087210872
"raw": "{{URL}}/challenges",
@@ -15401,4 +15401,4 @@
1540115401
]
1540215402
}
1540315403
]
15404-
}
15404+
}

package-lock.json

Lines changed: 38 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"joi": "^14.0.0",
3737
"jsonwebtoken": "^8.3.0",
3838
"lodash": "^4.17.11",
39-
"tc-bus-api-wrapper": "topcoder-platform/tc-bus-api-wrapper.git",
4039
"tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.6.2",
40+
"tc-bus-api-wrapper": "topcoder-platform/tc-bus-api-wrapper.git",
4141
"uuid": "^3.3.2",
4242
"winston": "^3.1.0"
4343
},

src/common/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function checkIfExists (source, term) {
160160
source = source.map(s => s.toLowerCase())
161161

162162
if (_.isString(term)) {
163-
terms = term.split(' ')
163+
terms = term.toLowerCase().split(' ')
164164
} else if (_.isArray(term)) {
165165
terms = term.map(t => t.toLowerCase())
166166
} else {

src/models/Challenge.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ const schema = new Schema({
6363
},
6464
forumId: {
6565
type: Number,
66+
required: false
67+
},
68+
startDate: {
69+
type: Date,
6670
required: true
6771
},
6872
status: {

src/routes.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ module.exports = {
127127
get: {
128128
controller: 'ChallengePhaseController',
129129
method: 'searchPhases',
130-
auth: 'jwt',
131-
access: [constants.UserRoles.Admin, constants.UserRoles.Copilot],
132130
scopes: [CHALLENGE_PHASES.READ, CHALLENGE_PHASES.ALL]
133131
},
134132
post: {
@@ -173,8 +171,6 @@ module.exports = {
173171
get: {
174172
controller: 'TimelineTemplateController',
175173
method: 'searchTimelineTemplates',
176-
auth: 'jwt',
177-
access: [constants.UserRoles.Admin, constants.UserRoles.Copilot],
178174
scopes: [TIMELINE_TEMPLATES.READ, TIMELINE_TEMPLATES.ALL]
179175
},
180176
post: {

src/services/ChallengeService.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,9 @@ createChallenge.schema = {
238238
reviewType: Joi.string().required(),
239239
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
240240
projectId: Joi.number().integer().positive().required(),
241-
forumId: Joi.number().integer().positive().required(),
242241
legacyId: Joi.number().integer().positive(),
242+
forumId: Joi.number().integer().positive(),
243+
startDate: Joi.date().required(),
243244
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
244245
groups: Joi.array().items(Joi.string()) // group names
245246
}).required()
@@ -303,7 +304,7 @@ async function getChallenge (currentUser, id) {
303304
// populate type property based on the typeId
304305
const type = await helper.getById('ChallengeType', challenge.typeId)
305306
challenge.type = type.name
306-
delete challenge.typeId
307+
// delete challenge.typeId
307308

308309
return populateSettings(challenge)
309310
}
@@ -646,8 +647,9 @@ fullyUpdateChallenge.schema = {
646647
reviewType: Joi.string().required(),
647648
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
648649
projectId: Joi.number().integer().positive().required(),
649-
forumId: Joi.number().integer().positive().required(),
650650
legacyId: Joi.number().integer().positive(),
651+
forumId: Joi.number().integer().positive(),
652+
startDate: Joi.date(),
651653
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
652654
attachmentIds: Joi.array().items(Joi.optionalId()),
653655
groups: Joi.array().items(Joi.string()) // group names
@@ -686,6 +688,7 @@ partiallyUpdateChallenge.schema = {
686688
isActive: Joi.boolean().required(),
687689
duration: Joi.number().positive().required()
688690
})).min(1),
691+
startDate: Joi.date(),
689692
prizeSets: Joi.array().items(Joi.object().keys({
690693
type: Joi.string().valid(_.values(constants.prizeSetTypes)).required(),
691694
description: Joi.string(),

0 commit comments

Comments
 (0)