Skip to content

Commit c4939d8

Browse files
Merge pull request #141 from topcoder-platform/dev
[PROD] Release 1.5
2 parents ce3257d + c82c025 commit c4939d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4022
-1373
lines changed

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

README.md

+189-109
Large diffs are not rendered by default.

Verification.md

-40
This file was deleted.

app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ app.use((err, req, res, next) => {
7575
}
7676

7777
if (err.response) {
78-
// extract error message from V3 API
79-
errorResponse.message = _.get(err, 'response.body.result.content')
78+
// extract error message from V3/V5 API
79+
errorResponse.message = _.get(err, 'response.body.result.content.message') || _.get(err, 'response.body.message')
8080
}
8181

8282
if (_.isUndefined(errorResponse.message)) {

config/config.json

-23
This file was deleted.

config/default.js

+62-2
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,123 @@
11
require('dotenv').config()
22
module.exports = {
3+
// the log level, default is 'debug'
34
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
5+
// the server port, default is 3000
46
PORT: process.env.PORT || 3000,
7+
// the server api base path
58
BASE_PATH: process.env.BASE_PATH || '/api/v5',
69

10+
// The authorization secret used during token verification.
711
AUTH_SECRET: process.env.AUTH_SECRET || 'mysecret',
12+
// The valid issuer of tokens, a json array contains valid issuer.
813
VALID_ISSUERS: process.env.VALID_ISSUERS || '["https://api.topcoder-dev.com", "https://api.topcoder.com", "https://topcoder-dev.auth0.com/", "https://auth.topcoder-dev.com/"]',
14+
// Auth0 URL, used to get TC M2M token
915
AUTH0_URL: process.env.AUTH0_URL,
16+
// Auth0 audience, used to get TC M2M token
1017
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
18+
// Auth0 audience for U-Bahn
1119
AUTH0_AUDIENCE_UBAHN: process.env.AUTH0_AUDIENCE_UBAHN,
20+
// Auth0 token cache time, used to get TC M2M token
1221
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
22+
// Auth0 client id, used to get TC M2M token
1323
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
24+
// Auth0 client secret, used to get TC M2M token
1425
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
26+
// Proxy Auth0 URL, used to get TC M2M token
1527
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
1628

1729
m2m: {
1830
M2M_AUDIT_USER_ID: process.env.M2M_AUDIT_USER_ID || '00000000-0000-0000-0000-000000000000',
1931
M2M_AUDIT_HANDLE: process.env.M2M_AUDIT_HANDLE || 'TopcoderService'
2032
},
2133

34+
// the Topcoder v5 url
2235
TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
36+
// the organization id
2337
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
38+
// the referenced skill provider id
2439
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',
2540

2641
TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
42+
// the api to find topcoder members
43+
TOPCODER_MEMBERS_API: process.env.TOPCODER_MEMBERS_API || 'https://api.topcoder-dev.com/v3/members',
44+
// rate limit of requests to user api
45+
MAX_PARALLEL_REQUEST_TOPCODER_USERS_API: process.env.MAX_PARALLEL_REQUEST_TOPCODER_USERS_API || 100,
2746

47+
// PostgreSQL database url.
2848
DATABASE_URL: process.env.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/postgres',
49+
// string - PostgreSQL database target schema
2950
DB_SCHEMA_NAME: process.env.DB_SCHEMA_NAME || 'bookings',
51+
// the project service url
3052
PROJECT_API_URL: process.env.PROJECT_API_URL || 'https://api.topcoder-dev.com',
3153

54+
// the default path for importing and exporting data
55+
DEFAULT_DATA_FILE_PATH: './data/demo-data.json',
56+
3257
esConfig: {
58+
// the elasticsearch host
3359
HOST: process.env.ES_HOST || 'http://localhost:9200',
3460

3561
ELASTICCLOUD: {
62+
// The elastic cloud id, if your elasticsearch instance is hosted on elastic cloud. DO NOT provide a value for ES_HOST if you are using this
3663
id: process.env.ELASTICCLOUD_ID,
64+
// The elastic cloud username for basic authentication. Provide this only if your elasticsearch instance is hosted on elastic cloud
3765
username: process.env.ELASTICCLOUD_USERNAME,
66+
// The elastic cloud password for basic authentication. Provide this only if your elasticsearch instance is hosted on elastic cloud
3867
password: process.env.ELASTICCLOUD_PASSWORD
3968
},
4069

70+
// The Amazon region to use when using AWS Elasticsearch service
4171
AWS_REGION: process.env.AWS_REGION || 'us-east-1', // AWS Region to be used if we use AWS ES
4272

73+
// the job index
4374
ES_INDEX_JOB: process.env.ES_INDEX_JOB || 'job',
75+
// the job candidate index
4476
ES_INDEX_JOB_CANDIDATE: process.env.ES_INDEX_JOB_CANDIDATE || 'job_candidate',
45-
ES_INDEX_RESOURCE_BOOKING: process.env.ES_INDEX_RESOURCE_BOOKING || 'resource_booking'
77+
// the resource booking index
78+
ES_INDEX_RESOURCE_BOOKING: process.env.ES_INDEX_RESOURCE_BOOKING || 'resource_booking',
79+
80+
// the max bulk size in MB for ES indexing
81+
MAX_BULK_REQUEST_SIZE_MB: process.env.MAX_BULK_REQUEST_SIZE_MB || 20,
82+
// the max number of documents per bulk for ES indexing
83+
MAX_BULK_NUM_DOCUMENTS: process.env.MAX_BULK_NUM_DOCUMENTS || 100
4684
},
4785

86+
// Topcoder Bus API URL
4887
BUSAPI_URL: process.env.BUSAPI_URL || 'https://api.topcoder-dev.com/v5',
88+
// The error topic at which bus api will publish any errors
4989
KAFKA_ERROR_TOPIC: process.env.KAFKA_ERROR_TOPIC || 'common.error.reporting',
90+
// The originator value for the kafka messages
5091
KAFKA_MESSAGE_ORIGINATOR: process.env.KAFKA_MESSAGE_ORIGINATOR || 'taas-api',
5192
// topics for job service
93+
// the create job entity Kafka message topic
5294
TAAS_JOB_CREATE_TOPIC: process.env.TAAS_JOB_CREATE_TOPIC || 'taas.job.create',
95+
// the update job entity Kafka message topic
5396
TAAS_JOB_UPDATE_TOPIC: process.env.TAAS_JOB_UPDATE_TOPIC || 'taas.job.update',
97+
// the delete job entity Kafka message topic
5498
TAAS_JOB_DELETE_TOPIC: process.env.TAAS_JOB_DELETE_TOPIC || 'taas.job.delete',
5599
// topics for jobcandidate service
100+
// the create job candidate entity Kafka message topic
56101
TAAS_JOB_CANDIDATE_CREATE_TOPIC: process.env.TAAS_JOB_CANDIDATE_CREATE_TOPIC || 'taas.jobcandidate.create',
102+
// the update job candidate entity Kafka message topic
57103
TAAS_JOB_CANDIDATE_UPDATE_TOPIC: process.env.TAAS_JOB_CANDIDATE_UPDATE_TOPIC || 'taas.jobcandidate.update',
104+
// the delete job candidate entity Kafka message topic
58105
TAAS_JOB_CANDIDATE_DELETE_TOPIC: process.env.TAAS_JOB_CANDIDATE_DELETE_TOPIC || 'taas.jobcandidate.delete',
59106
// topics for job service
107+
// the create resource booking entity Kafka message topic
60108
TAAS_RESOURCE_BOOKING_CREATE_TOPIC: process.env.TAAS_RESOURCE_BOOKING_CREATE_TOPIC || 'taas.resourcebooking.create',
109+
// the update resource booking entity Kafka message topic
61110
TAAS_RESOURCE_BOOKING_UPDATE_TOPIC: process.env.TAAS_RESOURCE_BOOKING_UPDATE_TOPIC || 'taas.resourcebooking.update',
62-
TAAS_RESOURCE_BOOKING_DELETE_TOPIC: process.env.TAAS_RESOURCE_BOOKING_DELETE_TOPIC || 'taas.resourcebooking.delete'
111+
// the delete resource booking entity Kafka message topic
112+
TAAS_RESOURCE_BOOKING_DELETE_TOPIC: process.env.TAAS_RESOURCE_BOOKING_DELETE_TOPIC || 'taas.resourcebooking.delete',
113+
114+
// the Kafka message topic for sending email
115+
EMAIL_TOPIC: process.env.EMAIL_TOPIC || 'external.action.email',
116+
// the emails address for receiving the issue report
117+
// REPORT_ISSUE_EMAILS may contain comma-separated list of email which is converted to array
118+
REPORT_ISSUE_EMAILS: (process.env.REPORT_ISSUE_EMAILS || '').split(','),
119+
// SendGrid email template ID for reporting issue
120+
REPORT_ISSUE_SENDGRID_TEMPLATE_ID: process.env.REPORT_ISSUE_SENDGRID_TEMPLATE_ID,
121+
// the URL where TaaS App is hosted
122+
TAAS_APP_URL: process.env.TAAS_APP_URL || 'https://platform.topcoder-dev.com/taas/myteams'
63123
}

config/email_template.config.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Configure email templates.
3+
* Variables can be used inside the subject and the message of a template(enclosed in double curly braces).
4+
*/
5+
6+
const config = require('config')
7+
8+
module.exports = {
9+
/* Report a general issue for a team.
10+
*
11+
* - projectId: the project ID. Example: 123412
12+
* - projectName: the project name. Example: "TaaS API Misc Updates"
13+
* - reportText: the body of reported issue. Example: "I have issue with ... \n ... Thank you in advance!"
14+
*/
15+
'team-issue-report': {
16+
subject: 'Issue Reported on TaaS Team {{projectName}} ({{projectId}}).',
17+
body: 'Project Name: {{projectName}}' + '\n' +
18+
'Project ID: {{projectId}}' + '\n' +
19+
`Project URL: ${config.TAAS_APP_URL}/{{projectId}}` + '\n' +
20+
'\n' +
21+
'{{reportText}}',
22+
recipients: config.REPORT_ISSUE_EMAILS,
23+
sendgridTemplateId: config.REPORT_ISSUE_SENDGRID_TEMPLATE_ID
24+
},
25+
/* Report issue for a particular member
26+
*
27+
* - userHandle: the user handle. Example: "bili_2021"
28+
* - projectId: the project ID. Example: 123412
29+
* - projectName: the project name. Example: "TaaS API Misc Updates"
30+
* - reportText: the body of reported issue. Example: "I have issue with ... \n ... Thank you in advance!"
31+
*/
32+
'member-issue-report': {
33+
subject: 'Issue Reported for member {{userHandle}} on TaaS Team {{projectName}} ({{projectId}}).',
34+
body: 'User Handle: {{userHandle}}' + '\n' +
35+
'Project Name: {{projectName}}' + '\n' +
36+
'Project ID: {{projectId}}' + '\n' +
37+
`Project URL: ${config.TAAS_APP_URL}/{{projectId}}` + '\n' +
38+
'\n' +
39+
'{{reportText}}',
40+
recipients: config.REPORT_ISSUE_EMAILS,
41+
sendgridTemplateId: config.REPORT_ISSUE_SENDGRID_TEMPLATE_ID
42+
}
43+
}

0 commit comments

Comments
 (0)