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

Commit 71eeb2c

Browse files
#47 - Read groups info from elasticsearch instead of group api
1 parent 1bd7de1 commit 71eeb2c

File tree

4 files changed

+0
-54
lines changed

4 files changed

+0
-54
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Configuration for the application is at config/default.js and config/production.
2828
- AUTH0_CLIENT_ID: Auth0 client id, used to get TC M2M token
2929
- AUTH0_CLIENT_SECRET: Auth0 client secret, used to get TC M2M token
3030
- AUTH0_PROXY_SERVER_URL: Proxy Auth0 URL, used to get TC M2M token
31-
- GROUP_API_URL: Topcoder Group API URL
3231
- BUSAPI_URL: Topcoder Bus API URL
3332
- KAFKA_ERROR_TOPIC: The error topic at which bus api will publish any errors
3433
- KAFKA_MESSAGE_ORIGINATOR: The originator value for the kafka messages

config/default.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = {
2626
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
2727
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
2828

29-
GROUP_API_URL: process.env.GROUP_API_URL || 'https://api.topcoder-dev.com/v5/groups',
3029
BUSAPI_URL: process.env.BUSAPI_URL || 'https://api.topcoder-dev.com/v5',
3130

3231
KAFKA_ERROR_TOPIC: process.env.KAFKA_ERROR_TOPIC || 'common.error.reporting',

src/common/es-helper.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const config = require('config')
22
const _ = require('lodash')
33
const querystring = require('querystring')
44
const logger = require('../common/logger')
5-
const groupApi = require('./group-api')
65
const appConst = require('../consts')
76
const esClient = require('./es-client').getESClient()
87

@@ -499,8 +498,6 @@ async function getFromElasticSearch (resource, ...args) {
499498

500499
if (params.enrich && resource === 'user') {
501500
const user = await enrichUser(result)
502-
const groups = await groupApi.getGroups(user.id)
503-
user.groups = groups
504501
return user
505502
} else if (subUserDoc) {
506503
// find top sub doc by sub.id
@@ -1305,11 +1302,6 @@ async function searchElasticSearch (resource, ...args) {
13051302
if (resource === 'user' && params.enrich) {
13061303
const users = docs.hits.hits.map(hit => hit._source)
13071304
result = await enrichUsers(users)
1308-
// enrich groups
1309-
for (const user of users) {
1310-
const groups = await groupApi.getGroups(user.id)
1311-
user.groups = groups
1312-
}
13131305
} else if (topUserSubDoc) {
13141306
result = docs.hits.hits[0]._source[topUserSubDoc.userField]
13151307
// for sub-resource query, it returns all sub-resource items in one user,
@@ -1430,11 +1422,6 @@ async function searchUsers (authUser, filter, params) {
14301422
logger.debug('Enrich users')
14311423

14321424
const result = await enrichUsers(users)
1433-
// enrich groups
1434-
for (const user of users) {
1435-
const groups = await groupApi.getGroups(user.id)
1436-
user.groups = groups
1437-
}
14381425

14391426
return {
14401427
total: getTotalCount(docs.hits.total),

src/common/group-api.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)