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

Commit 44ec63c

Browse files
author
James Cori
committed
Merge branch 'develop'
2 parents 6a9f157 + 650a79e commit 44ec63c

28 files changed

+1425
-1245
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_TASK| The registered type id of a task ||
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: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,18 @@ 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+
status: 'Draft'
6534
},
6635

6736
// NOTE: if subTrack is FIRST_2_FINISH,
6837
// this config has no effect since the ***EndsAt will be set automatically by TC APIs
6938
NEW_CHALLENGE_DURATION_IN_DAYS: process.env.NEW_CHALLENGE_DURATION_IN_DAYS || 5,
7039
TC_URL: process.env.TC_URL || 'https://www.topcoder-dev.com',
40+
TC_API_URL: process.env.TC_API_URL || 'https://api.topcoder-dev.com/v5',
41+
TC_API_URL_V3: process.env.TC_API_URL || 'https://api.topcoder-dev.com/v3',
7142
GITLAB_API_BASE_URL: process.env.GITLAB_API_BASE_URL || 'https://gitlab.com',
7243
ISSUE_LABEL_PREFIX: process.env.ISSUE_LABEL_PREFIX || 'tcx_',
7344
PAID_ISSUE_LABEL: process.env.PAID_ISSUE_LABEL || 'tcx_Paid',
@@ -93,5 +64,16 @@ module.exports = {
9364
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME || 43200,
9465
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
9566
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
96-
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL
67+
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
68+
GRANT_TYPE: 'client_credentials',
69+
70+
// used as base to construct various URLs
71+
WEBSITE: process.env.WEBSITE || 'http://topcoderx.topcoder-dev.com',
72+
WEBSITE_SECURE: process.env.WEBSITE_SECURE || 'https://topcoderx.topcoder-dev.com',
73+
74+
ROLE_ID_COPILOT: process.env.ROLE_ID_COPILOT || 'cfe12b3f-2a24-4639-9d8b-ec86726f76bd',
75+
ROLE_ID_SUBMITTER: process.env.ROLE_ID_SUBMITTER || '732339e7-8e30-49d7-9198-cccf9451e221',
76+
TYPE_ID_TASK: process.env.TYPE_ID_TASK || 'ecd58c69-238f-43a4-a4bb-d172719b9f31',
77+
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '53a307ce-b4b3-4d6f-b9a1-3741a58f77e6',
78+
DEFAULT_TRACK_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825'
9779
};

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_TASK| The registered type id of a task ||
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: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,31 @@ const USER_ROLES = {
2222
OWNER: 'owner'
2323
};
2424

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

34+
// issue status
35+
const ISSUE_STATUS = {
36+
CHALLENGE_CANCELLED: 'challenge_cancelled',
37+
CHALLENGE_CREATION_PENDING: 'challenge_creation_pending',
38+
CHALLENGE_CREATION_SUCCESSFUL: 'challenge_creation_successful',
39+
CHALLENGE_CREATION_FAILED: 'challenge_creation_failed',
40+
CHALLENGE_CREATION_RETRIED: 'challenge_creation_retried',
41+
CHALLENGE_PAYMENT_SUCCESSFUL: 'challenge_payment_successful',
42+
CHALLENGE_PAYMENT_PENDING: 'challenge_payment_pending',
43+
CHALLENGE_PAYMENT_FAILED: 'challenge_payment_failed'
44+
};
45+
2746
module.exports = {
2847
USER_ROLES,
2948
USER_TYPES,
30-
SERVICE_ERROR_STATUS
49+
SERVICE_ERROR_STATUS,
50+
CHALLENGE_STATUS,
51+
ISSUE_STATUS
3152
};

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const schema = new Schema({
4848
name: 'RepositoryIdIndex'
4949
}
5050
},
51+
repositoryIdStr: {type: String, required: false},
5152
labels: {
5253
type: Array,
5354
required: false
@@ -59,6 +60,7 @@ const schema = new Schema({
5960
},
6061
// From topcoder api
6162
challengeId: {type: Number, required: false},
63+
challengeUUID: {type: String, required: false},
6264
projectId: {type: String},
6365
status: {type: String},
6466
assignedAt: {type: Date, required: false}

models/Project.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,20 @@ const schema = new Schema({
3030
}
3131
},
3232
repoUrl: {type: String, required: true},
33+
repoId: {type: String, required: false},
3334
rocketChatWebhook: {type: String, required: false},
3435
rocketChatChannelName: {type: String, required: false},
3536
archived: {type: String, required: true},
3637
owner: {type: String, required: true},
3738
secretWebhookKey: {type: String, required: true},
3839
copilot: {type: String, required: false},
39-
registeredWebhookId: {type: String, required: false}
40+
registeredWebhookId: {type: String, required: false},
41+
updatedAt: {
42+
type: Date,
43+
default: Date.now
44+
},
45+
createCopilotPayments: {type: String, required: false},
46+
isConnect: {type: Boolean, required: false, default: true}
4047
});
4148

4249
module.exports = schema;

models/User.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ const schema = new Schema({
2828
name: 'UsesProviderIdIndex'
2929
}
3030
},
31+
userProviderIdStr: {
32+
type: String,
33+
required: false
34+
},
3135
username: {
3236
type: String,
3337
required: true,

models/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ dynamoose.setDefaults({
2626
update: false
2727
});
2828

29+
if (process.env.CREATE_DB) {
30+
dynamoose.setDefaults({
31+
create: true,
32+
update: true
33+
});
34+
}
35+
2936
/* eslint-disable global-require */
3037
const models = {
3138
Issue: dynamoose.model('Topcoder_X.Issue', require('./Issue')),

0 commit comments

Comments
 (0)