Skip to content

feature: support fetching stats by both legacy and new group ids #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following parameters can be set in config files or in env variables:
- AUTH0_CLIENT_SECRET: AUTH0 client secret, used to get M2M token
- BUSAPI_URL: Bus API URL
- KAFKA_ERROR_TOPIC: Kafka error topic used by bus API wrapper
- GROUPS_API_URL: Groups API URL
- AMAZON.AWS_ACCESS_KEY_ID: The Amazon certificate key to use when connecting. Use local dynamodb you can set fake value
- AMAZON.AWS_SECRET_ACCESS_KEY: The Amazon certificate access key to use when connecting. Use local dynamodb you can set fake value
- AMAZON.AWS_REGION: The Amazon certificate region to use when connecting. Use local dynamodb you can set fake value
Expand Down
2 changes: 1 addition & 1 deletion app-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const Joi = require('joi')
Joi.page = () => Joi.number().integer().min(1).default(1)
Joi.perPage = () => Joi.number().integer().min(1).max(100).default(50)
Joi.size = () => Joi.number().integer().min(1).max(1000).default(500)
Joi.sort = () => Joi.string().default("asc")
Joi.sort = () => Joi.string().default('asc')
4 changes: 2 additions & 2 deletions app-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = (app) => {
// add Authenticator/Authorization check if route has auth
actions.push((req, res, next) => {
// When authorization token is not provided and allow no token is enabled then bypass
if(!_.get(req, 'headers.authorization') && def.allowNoToken) {
if (!_.get(req, 'headers.authorization') && def.allowNoToken) {
next()
} else {
authenticator(_.pick(config, ['AUTH_SECRET', 'VALID_ISSUERS']))(req, res, next)
Expand All @@ -50,7 +50,7 @@ module.exports = (app) => {

actions.push((req, res, next) => {
// When authorization token is not provided and allow no token is enabled then bypass
if(!_.get(req, 'headers.authorization') && def.allowNoToken) {
if (!_.get(req, 'headers.authorization') && def.allowNoToken) {
next()
} else {
if (req.authUser.isMachine) {
Expand Down
37 changes: 18 additions & 19 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ module.exports = {
TAGS: {
TAGS_BASE_URL: process.env.TAGS_BASE_URL || 'https://api.topcoder-dev.com',
TAGS_API_VERSION: process.env.TAGS_API_VERSION || '/v3',
TAGS_FILTER: process.env.TAGS_FILTER || '/tags/?filter=domain%3DSKILLS%26status%3DAPPROVED&limit=1000',
TAGS_FILTER: process.env.TAGS_FILTER || '/tags/?filter=domain%3DSKILLS%26status%3DAPPROVED&limit=1000'
},

GROUPS_API_URL: process.env.GROUPS_API_URL || 'https://api.topcoder-dev.com/v5/groups',
// aws config params
AMAZON: {
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,
Expand All @@ -48,7 +48,7 @@ module.exports = {
MEMBER_PROFILE_ES_INDEX: process.env.MEMBER_PROFILE_ES_INDEX || 'members-2020-01',
// member type, ES 6.x accepts only 1 Type per index and it's mandatory to define it
MEMBER_PROFILE_ES_TYPE: process.env.MEMBER_PROFILE_ES_TYPE || 'profiles',
MEMBER_TRAIT_ES_INDEX: process.env.MEMBER_TRAIT_ES_INDEX || 'members-2020-01',
MEMBER_TRAIT_ES_INDEX: process.env.MEMBER_TRAIT_ES_INDEX || 'membertraits-2020-01',
MEMBER_TRAIT_ES_TYPE: process.env.MEMBER_TRAIT_ES_TYPE || 'profiletraits',
MEMBER_STATS_ES_INDEX: process.env.MEMBER_STATS_ES_INDEX || 'memberstats-2020-01',
MEMBER_STATS_ES_TYPE: process.env.MEMBER_STATS_ES_TYPE || 'stats',
Expand All @@ -62,12 +62,12 @@ module.exports = {
// file upload max size in bytes
FILE_UPLOAD_SIZE_LIMIT: process.env.FILE_UPLOAD_SIZE_LIMIT
? Number(process.env.FILE_UPLOAD_SIZE_LIMIT) : 10 * 1024 * 1024, // 10M

// photo URL template, its <key> will be replaced with S3 object key,
// the URL is specific to AWS region and bucket, you may go to AWS console S3 service to
// see bucket object URL to get the URL structure
PHOTO_URL_TEMPLATE: process.env.PHOTO_URL_TEMPLATE || 'https://topcoder-dev-media.s3.us-east-1.amazonaws.com/member/profile/<key>',

// verify token expiration in minutes
VERIFY_TOKEN_EXPIRATION: process.env.VERIFY_TOKEN_EXPIRATION || 60,

Expand All @@ -84,33 +84,32 @@ module.exports = {
READ: process.env.SCOPE_MEMBERS_READ || 'read:user_profiles',
UPDATE: process.env.SCOPE_MEMBERS_UPDATE || 'update:user_profiles',
DELETE: process.env.SCOPE_MEMBERS_DELETE || 'delete:user_profiles',
ALL: process.env.SCOPE_MEMBERS_ALL || 'all:user_profiles',
ALL: process.env.SCOPE_MEMBERS_ALL || 'all:user_profiles'
}
},

// Member identifiable info fields, only admin, M2M, or member himself can get these fields
MEMBER_SECURE_FIELDS: process.env.MEMBER_SECURE_FIELDS
? process.env.MEMBER_SECURE_FIELDS.split(',')
MEMBER_SECURE_FIELDS: process.env.MEMBER_SECURE_FIELDS
? process.env.MEMBER_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],

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

// Misc identifiable info fields, only admin, M2M, or member himself can fetch these fields
MISC_SECURE_FIELDS: process.env.MISC_SECURE_FIELDS
? process.env.MISC_SECURE_FIELDS.split(',')
MISC_SECURE_FIELDS: process.env.MISC_SECURE_FIELDS
? process.env.MISC_SECURE_FIELDS.split(',')
: ['createdBy', 'updatedBy'],

// Member Search identifiable info fields, only admin, M2M, or member himself can fetch these fields
SEARCH_SECURE_FIELDS: process.env.SEARCH_SECURE_FIELDS
? process.env.SEARCH_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],
SEARCH_SECURE_FIELDS: process.env.SEARCH_SECURE_FIELDS
? process.env.SEARCH_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],

// Member Statistics identifiable info fields, only admin, M2M, or member himself can fetch these fields
STATISTICS_SECURE_FIELDS: process.env.STATISTICS_SECURE_FIELDS
? process.env.STATISTICS_SECURE_FIELDS.split(',')
: ['createdBy', 'updatedBy']

}
Loading