Skip to content

Commit 5d0fb5e

Browse files
Add support for challenge startDate
1 parent 52f611e commit 5d0fb5e

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

docs/swagger.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,10 @@ definitions:
16711671
forumId:
16721672
type: integer
16731673
description: the forum id
1674+
startDate:
1675+
type: string
1676+
format: date-time
1677+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
16741678
status:
16751679
type: string
16761680
description: the status
@@ -1876,6 +1880,10 @@ definitions:
18761880
forumId:
18771881
type: integer
18781882
description: the forum id
1883+
startDate:
1884+
type: string
1885+
format: date-time
1886+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
18791887
status:
18801888
type: string
18811889
description: the status
@@ -1968,6 +1976,10 @@ definitions:
19681976
forumId:
19691977
type: integer
19701978
description: the forum id
1979+
startDate:
1980+
type: string
1981+
format: date-time
1982+
description: 'ISO-8601 formatted date times (YYYY-MM-DDTHH:mm:ss.sssZ)'
19711983
status:
19721984
type: string
19731985
description: the status

docs/topcoder-challenge-api.postman_collection.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "ff61aad3-5167-4ac5-b054-ee2ff3a3eb90",
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
},
@@ -10570,7 +10570,7 @@
1057010570
],
1057110571
"body": {
1057210572
"mode": "raw",
10573-
"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}"
10573+
"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}"
1057410574
},
1057510575
"url": {
1057610576
"raw": "{{URL}}/challenges",
@@ -10622,7 +10622,7 @@
1062210622
],
1062310623
"body": {
1062410624
"mode": "raw",
10625-
"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}"
10625+
"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}"
1062610626
},
1062710627
"url": {
1062810628
"raw": "{{URL}}/challenges",

src/models/Challenge.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ const schema = new Schema({
6565
type: Number,
6666
required: false
6767
},
68+
startDate: {
69+
type: Date,
70+
required: true
71+
},
6872
status: {
6973
type: String,
7074
required: true

src/services/ChallengeService.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ createChallenge.schema = {
188188
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
189189
projectId: Joi.number().integer().positive().required(),
190190
forumId: Joi.number().integer().positive(),
191+
startDate: Joi.date().required(),
191192
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
192193
groups: Joi.array().items(Joi.string()) // group names
193194
}).required()
@@ -553,6 +554,7 @@ fullyUpdateChallenge.schema = {
553554
tags: Joi.array().items(Joi.string().required()).min(1).required(), // tag names
554555
projectId: Joi.number().integer().positive().required(),
555556
forumId: Joi.number().integer().positive(),
557+
startDate: Joi.date(),
556558
status: Joi.string().valid(_.values(constants.challengeStatuses)).required(),
557559
attachmentIds: Joi.array().items(Joi.optionalId()),
558560
groups: Joi.array().items(Joi.string()) // group names
@@ -591,6 +593,7 @@ partiallyUpdateChallenge.schema = {
591593
isActive: Joi.boolean().required(),
592594
duration: Joi.number().positive().required()
593595
})).min(1),
596+
startDate: Joi.date(),
594597
prizeSets: Joi.array().items(Joi.object().keys({
595598
type: Joi.string().valid(_.values(constants.prizeSetTypes)).required(),
596599
description: Joi.string(),

0 commit comments

Comments
 (0)