Skip to content

Commit 0e06e06

Browse files
authored
Merge pull request #32 from topcoder-platform/develop
feature: support fetching stats by both legacy and new group ids
2 parents fb6218f + 7c81f83 commit 0e06e06

17 files changed

+505
-391
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The following parameters can be set in config files or in env variables:
2525
- AUTH0_CLIENT_SECRET: AUTH0 client secret, used to get M2M token
2626
- BUSAPI_URL: Bus API URL
2727
- KAFKA_ERROR_TOPIC: Kafka error topic used by bus API wrapper
28+
- GROUPS_API_URL: Groups API URL
2829
- AMAZON.AWS_ACCESS_KEY_ID: The Amazon certificate key to use when connecting. Use local dynamodb you can set fake value
2930
- AMAZON.AWS_SECRET_ACCESS_KEY: The Amazon certificate access key to use when connecting. Use local dynamodb you can set fake value
3031
- AMAZON.AWS_REGION: The Amazon certificate region to use when connecting. Use local dynamodb you can set fake value

app-bootstrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ const Joi = require('joi')
77
Joi.page = () => Joi.number().integer().min(1).default(1)
88
Joi.perPage = () => Joi.number().integer().min(1).max(100).default(50)
99
Joi.size = () => Joi.number().integer().min(1).max(1000).default(500)
10-
Joi.sort = () => Joi.string().default("asc")
10+
Joi.sort = () => Joi.string().default('asc')

app-routes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = (app) => {
4141
// add Authenticator/Authorization check if route has auth
4242
actions.push((req, res, next) => {
4343
// When authorization token is not provided and allow no token is enabled then bypass
44-
if(!_.get(req, 'headers.authorization') && def.allowNoToken) {
44+
if (!_.get(req, 'headers.authorization') && def.allowNoToken) {
4545
next()
4646
} else {
4747
authenticator(_.pick(config, ['AUTH_SECRET', 'VALID_ISSUERS']))(req, res, next)
@@ -50,7 +50,7 @@ module.exports = (app) => {
5050

5151
actions.push((req, res, next) => {
5252
// When authorization token is not provided and allow no token is enabled then bypass
53-
if(!_.get(req, 'headers.authorization') && def.allowNoToken) {
53+
if (!_.get(req, 'headers.authorization') && def.allowNoToken) {
5454
next()
5555
} else {
5656
if (req.authUser.isMachine) {

config/default.js

+18-19
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module.exports = {
2525
TAGS: {
2626
TAGS_BASE_URL: process.env.TAGS_BASE_URL || 'https://api.topcoder-dev.com',
2727
TAGS_API_VERSION: process.env.TAGS_API_VERSION || '/v3',
28-
TAGS_FILTER: process.env.TAGS_FILTER || '/tags/?filter=domain%3DSKILLS%26status%3DAPPROVED&limit=1000',
28+
TAGS_FILTER: process.env.TAGS_FILTER || '/tags/?filter=domain%3DSKILLS%26status%3DAPPROVED&limit=1000'
2929
},
30-
30+
GROUPS_API_URL: process.env.GROUPS_API_URL || 'https://api.topcoder-dev.com/v5/groups',
3131
// aws config params
3232
AMAZON: {
3333
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,
@@ -48,7 +48,7 @@ module.exports = {
4848
MEMBER_PROFILE_ES_INDEX: process.env.MEMBER_PROFILE_ES_INDEX || 'members-2020-01',
4949
// member type, ES 6.x accepts only 1 Type per index and it's mandatory to define it
5050
MEMBER_PROFILE_ES_TYPE: process.env.MEMBER_PROFILE_ES_TYPE || 'profiles',
51-
MEMBER_TRAIT_ES_INDEX: process.env.MEMBER_TRAIT_ES_INDEX || 'members-2020-01',
51+
MEMBER_TRAIT_ES_INDEX: process.env.MEMBER_TRAIT_ES_INDEX || 'membertraits-2020-01',
5252
MEMBER_TRAIT_ES_TYPE: process.env.MEMBER_TRAIT_ES_TYPE || 'profiletraits',
5353
MEMBER_STATS_ES_INDEX: process.env.MEMBER_STATS_ES_INDEX || 'memberstats-2020-01',
5454
MEMBER_STATS_ES_TYPE: process.env.MEMBER_STATS_ES_TYPE || 'stats',
@@ -62,12 +62,12 @@ module.exports = {
6262
// file upload max size in bytes
6363
FILE_UPLOAD_SIZE_LIMIT: process.env.FILE_UPLOAD_SIZE_LIMIT
6464
? Number(process.env.FILE_UPLOAD_SIZE_LIMIT) : 10 * 1024 * 1024, // 10M
65-
65+
6666
// photo URL template, its <key> will be replaced with S3 object key,
6767
// the URL is specific to AWS region and bucket, you may go to AWS console S3 service to
6868
// see bucket object URL to get the URL structure
6969
PHOTO_URL_TEMPLATE: process.env.PHOTO_URL_TEMPLATE || 'https://topcoder-dev-media.s3.us-east-1.amazonaws.com/member/profile/<key>',
70-
70+
7171
// verify token expiration in minutes
7272
VERIFY_TOKEN_EXPIRATION: process.env.VERIFY_TOKEN_EXPIRATION || 60,
7373

@@ -84,33 +84,32 @@ module.exports = {
8484
READ: process.env.SCOPE_MEMBERS_READ || 'read:user_profiles',
8585
UPDATE: process.env.SCOPE_MEMBERS_UPDATE || 'update:user_profiles',
8686
DELETE: process.env.SCOPE_MEMBERS_DELETE || 'delete:user_profiles',
87-
ALL: process.env.SCOPE_MEMBERS_ALL || 'all:user_profiles',
87+
ALL: process.env.SCOPE_MEMBERS_ALL || 'all:user_profiles'
8888
}
8989
},
90-
90+
9191
// Member identifiable info fields, only admin, M2M, or member himself can get these fields
92-
MEMBER_SECURE_FIELDS: process.env.MEMBER_SECURE_FIELDS
93-
? process.env.MEMBER_SECURE_FIELDS.split(',')
92+
MEMBER_SECURE_FIELDS: process.env.MEMBER_SECURE_FIELDS
93+
? process.env.MEMBER_SECURE_FIELDS.split(',')
9494
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],
9595

9696
// Member traits identifiable info fields, only admin, M2M, or member himself can fetch these fields
97-
MEMBER_TRAIT_SECURE_FIELDS: process.env.MEMBER_TRAIT_SECURE_FIELDS
98-
? process.env.MEMBER_TRAIT_SECURE_FIELDS.split(',')
97+
MEMBER_TRAIT_SECURE_FIELDS: process.env.MEMBER_TRAIT_SECURE_FIELDS
98+
? process.env.MEMBER_TRAIT_SECURE_FIELDS.split(',')
9999
: ['createdBy', 'updatedBy'],
100100

101101
// Misc identifiable info fields, only admin, M2M, or member himself can fetch these fields
102-
MISC_SECURE_FIELDS: process.env.MISC_SECURE_FIELDS
103-
? process.env.MISC_SECURE_FIELDS.split(',')
102+
MISC_SECURE_FIELDS: process.env.MISC_SECURE_FIELDS
103+
? process.env.MISC_SECURE_FIELDS.split(',')
104104
: ['createdBy', 'updatedBy'],
105-
105+
106106
// Member Search identifiable info fields, only admin, M2M, or member himself can fetch these fields
107-
SEARCH_SECURE_FIELDS: process.env.SEARCH_SECURE_FIELDS
108-
? process.env.SEARCH_SECURE_FIELDS.split(',')
109-
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],
110-
107+
SEARCH_SECURE_FIELDS: process.env.SEARCH_SECURE_FIELDS
108+
? process.env.SEARCH_SECURE_FIELDS.split(',')
109+
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],
110+
111111
// Member Statistics identifiable info fields, only admin, M2M, or member himself can fetch these fields
112112
STATISTICS_SECURE_FIELDS: process.env.STATISTICS_SECURE_FIELDS
113113
? process.env.STATISTICS_SECURE_FIELDS.split(',')
114114
: ['createdBy', 'updatedBy']
115-
116115
}

0 commit comments

Comments
 (0)