Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2cd2c41

Browse files
committedSep 21, 2020
Updates for v5
1 parent 97d13d6 commit 2cd2c41

17 files changed

+700
-914
lines changed
 

‎README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ The following config parameters are supported, they are defined in `config/defau
3131
| KAFKA_OPTIONS | the connection option for kafka | see below about KAFKA options |
3232
|TC_DEV_ENV| the flag whether to use topcoder development api or production| false|
3333
| TC_AUTHN_URL | the Topcoder authentication url | https://topcoder-dev.auth0.com/oauth/ro |
34-
| TC_AUTHN_REQUEST_BODY | the Topcoder authentication request body. This makes use of some environment variables: `TC_USERNAME`, `TC_PASSWORD`, `TC_CLIENT_ID`, `CLIENT_V2CONNECTION` | see `default.js` |
3534
| TC_AUTHZ_URL | the Topcoder authorization url | https://api.topcoder-dev.com/v3/authorizations |
3635
| NEW_CHALLENGE_TEMPLATE | the body template for new challenge request. You can change the subTrack, reviewTypes, technologies, .. here | see `default.js` |
3736
| NEW_CHALLENGE_DURATION_IN_DAYS | the duration of new challenge | 5 |
@@ -54,6 +53,12 @@ The following config parameters are supported, they are defined in `config/defau
5453
|TOKEN_CACHE_TIME| The machine-to-machine token cache validation time |43200|
5554
|AUTH0_CLIENT_ID| The Auth0 ClientID for generating Machine-to-machine token ||
5655
|AUTH0_CLIENT_SECRET| The Auth0 Client Secret for generating Machine-to-machine token ||
56+
|ROLE_ID_COPILOT| The registered role id of copilot ||
57+
|ROLE_ID_SUBMITTER| The registered role id of submitter ||
58+
|TYPE_ID_FIRST2FINISH| The registered type id of first 2 finish challenge ||
59+
|DEFAULT_TIMELINE_TEMPLATE_ID| The default timeline template id ||
60+
|TC_API_URL| The topcoder backend API url |`https://api.topcoder-dev.com/v5`|
61+
|TC_API_URL_V3| The topcoder backend API url V3 |`https://api.topcoder-dev.com/v3`|
5762

5863
KAFKA_OPTIONS should be object as described in https://github.com/oleksiyk/kafka#ssl
5964
For using with SSL, the options should be as
@@ -172,7 +177,7 @@ This is a description
172177

173178
- You will see a new comments
174179

175-
Contest https://www.topcoder-dev.com/challenges/30054075 has been created for this ticket.
180+
Challenge 17ab4b5b-fad6-405a-8abb-9f23e9fa3730 has been created for this ticket
176181

177182
```This is an automated message for tonyj via Topcoder X```
178183

@@ -212,7 +217,7 @@ https://www.topcoder-dev.com/challenges/30054075
212217
- ticket added assignee
213218
- add comments
214219

215-
Contest https://www.topcoder-dev.com/challenges/30054075 has been updated - it has been assigned to tonyj.<br/><br/>```This is an automated message for tonyj via Topcoder X```
220+
Challenge 17ab4b5b-fad6-405a-8abb-9f23e9fa3730 has been assigned to mess.<br/><br/>```This is an automated message for tonyj via Topcoder X```
216221

217222
- Visit the challenge url to verify registered member
218223

@@ -232,7 +237,7 @@ Contest https://www.topcoder-dev.com/challenges/30054075 has been updated - it h
232237
- Unassign member of issue
233238
- Wait a minute or more
234239
- Ticket adds comments
235-
Contest https://www.topcoder-dev.com/challenges/30054075 has been updated - tonyj has been unassigned.<br/><br/>```This is an automated message for tonyj via Topcoder X```
240+
Challenge 17ab4b5b-fad6-405a-8abb-9f23e9fa3730 mess has been unassigned.<br/><br/>```This is an automated message for tonyj via Topcoder X```
236241
- Ticket updated labels
237242
added tcx_OpenForPickup and removed tcx_Assigned labels
238243
- Visit the challenge url to verify no registered member
@@ -264,7 +269,7 @@ This ticket was not processed for payment. If you would like to process it for p
264269
- Close ticket
265270
- Ticket adds tcx_Paid label
266271
- Ticket adds comments
267-
Payment task has been updated: https://software.topcoder-dev.com/review/actions/ViewProjectDetails?pid=30054000<br/><br/>```This is an automated message for tonyj via Topcoder X```
272+
Challenge 17ab4b5b-fad6-405a-8abb-9f23e9fa3730 has been paid and closed<br/><br/>```This is an automated message for tonyj via Topcoder X```
268273
- Ticket closed comment
269274
- Wait a long time (Challenge status will change to Active and then change to Completed for long time later)
270275
- Visit the challenge on TC Direct to verify challenge status is Active and change to Completed after 17 minute or more

‎config/default.js

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,23 @@ module.exports = {
2727
},
2828
TC_DEV_ENV: process.env.NODE_ENV === 'production' ? false : true,
2929
TC_AUTHN_URL: process.env.TC_AUTHN_URL || 'https://topcoder-dev.auth0.com/oauth/ro',
30-
TC_AUTHN_REQUEST_BODY: {
31-
username: process.env.TC_USERNAME || 'mess',
32-
password: process.env.TC_PASSWORD || 'appirio123',
33-
client_id: process.env.TC_CLIENT_ID || 'JFDo7HMkf0q2CkVFHojy3zHWafziprhT',
34-
sso: false,
35-
scope: 'openid profile offline_access',
36-
response_type: 'token',
37-
connection: process.env.CLIENT_V2CONNECTION || 'TC-User-Database',
38-
grant_type: 'password',
39-
device: 'Browser'
40-
},
4130
TC_AUTHZ_URL: process.env.TC_AUTHZ_URL || 'https://api.topcoder-dev.com/v3/authorizations',
31+
TC_DIRECT_ID: 7377,
4232
NEW_CHALLENGE_TEMPLATE: process.env.NEW_CHALLENGE_TEMPLATE || {
43-
milestoneId: 1,
44-
subTrack: 'FIRST_2_FINISH',
45-
reviewType: 'COMMUNITY',
46-
technologies: [],
47-
platforms: [],
48-
finalDeliverableTypes: [],
49-
confidentialityType: 'PUBLIC',
50-
submissionGuidelines: 'Upload the updated code to TopCoder',
51-
52-
// From here, the properties will be set by the processor.
53-
// Just leave them here for readability
54-
name: null,
55-
projectId: null,
56-
registrationStartDate: null,
57-
registrationStartsAt: null,
58-
59-
// NOTE: if subTrack is FIRST_2_FINISH,
60-
// the ***EndsAt will be set automatically by TC APIs
61-
registrationEndsAt: null,
62-
submissionEndsAt: null,
63-
detailedRequirements: null,
64-
prizes: null
33+
legacy: {
34+
reviewType: 'community',
35+
track: 'DEVELOP',
36+
directProjectId: 7377
37+
},
38+
status: 'Draft'
6539
},
6640

6741
// NOTE: if subTrack is FIRST_2_FINISH,
6842
// this config has no effect since the ***EndsAt will be set automatically by TC APIs
6943
NEW_CHALLENGE_DURATION_IN_DAYS: process.env.NEW_CHALLENGE_DURATION_IN_DAYS || 5,
7044
TC_URL: process.env.TC_URL || 'https://www.topcoder-dev.com',
45+
TC_API_URL: process.env.TC_API_URL || 'https://api.topcoder-dev.com/v5',
46+
TC_API_URL_V3: process.env.TC_API_URL || 'https://api.topcoder-dev.com/v3',
7147
GITLAB_API_BASE_URL: process.env.GITLAB_API_BASE_URL || 'https://gitlab.com',
7248
ISSUE_LABEL_PREFIX: process.env.ISSUE_LABEL_PREFIX || 'tcx_',
7349
PAID_ISSUE_LABEL: process.env.PAID_ISSUE_LABEL || 'tcx_Paid',
@@ -94,9 +70,15 @@ module.exports = {
9470
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
9571
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
9672
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
73+
GRANT_TYPE: 'client_credentials',
9774

9875
// used as base to construct various URLs
9976
WEBSITE: process.env.WEBSITE || 'http://topcoderx.topcoder-dev.com',
10077
WEBSITE_SECURE: process.env.WEBSITE_SECURE || 'https://topcoderx.topcoder-dev.com',
10178

79+
ROLE_ID_COPILOT: process.env.ROLE_ID_COPILOT || 'cfe12b3f-2a24-4639-9d8b-ec86726f76bd',
80+
ROLE_ID_SUBMITTER: process.env.ROLE_ID_SUBMITTER || '732339e7-8e30-49d7-9198-cccf9451e221',
81+
TYPE_ID_FIRST2FINISH: process.env.TYPE_ID_FIRST2FINISH || '927abff4-7af9-4145-8ba1-577c16e64e2e',
82+
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '7ebf1c69-f62f-4d3a-bdfb-fe9ddb56861c',
83+
DEFAULT_TRACK_ID : process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825'
10284
};

‎configuration.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The following config parameters are supported, they are defined in `config/defau
1414
|KAFKA_CLIENT_CERT_KEY | The Kafka SSL certificate key to use when connecting| Read from kafka_client.key file, but this can be set as a string like it is on Heroku|
1515
|TC_DEV_ENV| the flag whether to use topcoder development api or production| false|
1616
| TC_AUTHN_URL | the Topcoder authentication url | https://topcoder-dev.auth0.com/oauth/ro |
17-
| TC_AUTHN_REQUEST_BODY | the Topcoder authentication request body. This makes use of some environment variables: `TC_USERNAME`, `TC_PASSWORD`, `TC_CLIENT_ID`, `CLIENT_V2CONNECTION` | see `default.js` |
1817
| TC_AUTHZ_URL | the Topcoder authorization url | https://api.topcoder-dev.com/v3/authorizations |
1918
| NEW_CHALLENGE_TEMPLATE | the body template for new challenge request. You can change the subTrack, reviewTypes, technologies, .. here | see `default.js` |
2019
| NEW_CHALLENGE_DURATION_IN_DAYS | the duration of new challenge | 5 |
@@ -40,6 +39,13 @@ The following config parameters are supported, they are defined in `config/defau
4039
|TOKEN_CACHE_TIME| The machine-to-machine token cache validation time |43200|
4140
|AUTH0_CLIENT_ID| The Auth0 ClientID for generating Machine-to-machine token ||
4241
|AUTH0_CLIENT_SECRET| The Auth0 Client Secret for generating Machine-to-machine token ||
42+
|ROLE_ID_COPILOT| The registered role id of copilot ||
43+
|ROLE_ID_SUBMITTER| The registered role id of submitter ||
44+
|TYPE_ID_FIRST2FINISH| The registered type id of first 2 finish challenge ||
45+
|DEFAULT_TIMELINE_TEMPLATE_ID| The default timeline template id ||
46+
|TC_API_URL| The topcoder backend API url |`https://api.topcoder-dev.com/v5`|
47+
|TC_API_URL_V3| The topcoder backend API url V3 |`https://api.topcoder-dev.com/v3`|
48+
|DEFAULT_TRACK_ID| The default track id ||
4349

4450
KAFKA_OPTIONS should be object as described in https://github.com/oleksiyk/kafka#ssl
4551
For using with SSL, the options should be as

‎constants.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ const USER_ROLES = {
2222
OWNER: 'owner'
2323
};
2424

25+
// The challenge status
26+
const CHALLENGE_STATUS = {
27+
ACTIVE: 'Active',
28+
COMPLETED: 'Completed',
29+
CANCELED: 'Canceled'
30+
};
31+
2532
const SERVICE_ERROR_STATUS = 500;
2633

2734
module.exports = {
2835
USER_ROLES,
2936
USER_TYPES,
30-
SERVICE_ERROR_STATUS
37+
SERVICE_ERROR_STATUS,
38+
CHALLENGE_STATUS
3139
};

‎models/CopilotPayment.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ const schema = new Schema({
4141
name: 'ChallengeIdIndex'
4242
}
4343
},
44+
challengeUUID: {
45+
type: String,
46+
required: false,
47+
index: {
48+
global: true,
49+
project: true,
50+
name: 'ChallengeUUIdIndex'
51+
}
52+
},
4453
closed: {
4554
type: String,
4655
required: true,

‎models/Issue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const schema = new Schema({
6060
},
6161
// From topcoder api
6262
challengeId: {type: Number, required: false},
63+
challengeUUID: {type: String, required: false},
6364
projectId: {type: String},
6465
status: {type: String},
6566
assignedAt: {type: Date, required: false}

0 commit comments

Comments
 (0)
This repository has been archived.