Skip to content

Commit 8a81f6e

Browse files
Member traits
1 parent dbbf36d commit 8a81f6e

25 files changed

+2926
-180
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ The following parameters can be set in config files or in env variables:
3535
- ES: config object for Elasticsearch
3636
- ES.HOST: Elasticsearch host
3737
- ES.API_VERSION: Elasticsearch API version
38-
- ES.ES_INDEX: Elasticsearch index name
39-
- ES.ES_TYPE: Elasticsearch index type
38+
- ES.ES_INDEX: Elasticsearch index name for member
39+
- ES.ES_TYPE: Elasticsearch index type for member
40+
- ES.MEMBER_TRAIT_ES_INDEX: Elasticsearch index name for member trait
41+
- ES.MEMBER_TRAIT_ES_TYPE: Elasticsearch index type for member trait
4042
- FILE_UPLOAD_SIZE_LIMIT: the file upload size limit in bytes
4143
- ID_FIELDS: member identifiable info fields, only admin, M2M, or member himself can get these fields
4244
- PHOTO_URL_TEMPLATE: photo URL template, its <key> will be replaced with S3 object key
@@ -88,8 +90,8 @@ It starts Elasticsearch, DynamoDB and S3 compatible server.
8890
3. Initialize/Clear database: `npm run init-db`
8991
4. Create Elasticsearch index: `npm run init-es`, or to re-create index: `npm run init-es force`
9092
5. Seed/Insert data to ES and DB: `npm run seed-data`
91-
6. View DB table data: `npm run view-db-data <ModelName>`, ModelName can be `Member`
92-
7. View ES data: `npm run view-es-data`
93+
6. View DB table data: `npm run view-db-data <ModelName>`, ModelName can be `Member`, `MemberTrait`
94+
7. View ES data: `npm run view-es-data <IndexName>`, IndexName can be `member`, `member_trait`
9395

9496
## Local Deployment
9597

@@ -166,3 +168,10 @@ Refer to the verification document `Verification.md`
166168

167169
- all JWT tokens provided in Postman environment file and tests are created in `https://jwt.io` with secret `mysecret`
168170

171+
- you don't need to setup the (https://github.com/topcoder-platform/member-processor-es),
172+
because there is seed-data script to setup data to test the members API,
173+
the tests also have setup data properly
174+
175+
- the tests use mock S3 service to upload member photo, so you may use the provided mock AWS credential for tests,
176+
but Postman tests require using real AWS S3, you need to follow README.md to create S3 bucket and provide your own AWS credential
177+
so that the upload photo API works

Verification.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
- clear the environment, run command `npm run init-db` and `npm run init-es force`
55
- create test data in ES and DB, run `npm run seed-data`
66
- import Postman collection and environment in the docs folder to Postman
7-
- run the tests
7+
- run the Postman tests
88

99
## DynamoDB Verification
10-
Run command `npm run view-db-data <ModelName>` to view table data, ModelName can be `Member`
10+
Run command `npm run view-db-data <ModelName>` to view table data, ModelName can be `Member`, `MemberTrait`
1111

1212
## S3 Verification
1313

1414
Login to AWS Console, S3 service, view the bucket content.
1515

1616
## ElasticSearch Verification
1717

18-
Run command `npm run view-es-data` to view data store in ES.
18+
Run command `npm run view-es-data <IndexName>` to view data store in ES, IndexName can be `member`, `member_trait`
1919

2020
## Bus Event Verification
2121

app-constants.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ const EVENT_MIME_TYPE = 'application/json'
99

1010
const TOPICS = {
1111
MemberUpdated: 'member.action.profile.update',
12-
EmailChanged: 'member.action.email.profile.emailchange.verification'
12+
EmailChanged: 'member.action.email.profile.emailchange.verification',
13+
MemberTraitCreated: 'member.action.profile.trait.create',
14+
MemberTraitUpdated: 'member.action.profile.trait.update',
15+
MemberTraitDeleted: 'member.action.profile.trait.delete'
1316
}
1417

18+
const ES_SEARCH_MAX_SIZE = 9999
19+
1520
module.exports = {
1621
ADMIN_ROLES,
1722
EVENT_ORIGINATOR,
1823
EVENT_MIME_TYPE,
19-
TOPICS
24+
TOPICS,
25+
ES_SEARCH_MAX_SIZE
2026
}

config/default.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ module.exports = {
3535
// above AWS_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are used if we use AWS ES
3636
HOST: process.env.ES_HOST || 'localhost:9200',
3737
API_VERSION: process.env.ES_API_VERSION || '6.8',
38+
// member index
3839
ES_INDEX: process.env.ES_INDEX || 'member',
39-
ES_TYPE: process.env.ES_TYPE || '_doc' // ES 6.x accepts only 1 Type per index and it's mandatory to define it
40+
// member type, ES 6.x accepts only 1 Type per index and it's mandatory to define it
41+
ES_TYPE: process.env.ES_TYPE || '_doc',
42+
MEMBER_TRAIT_ES_INDEX: process.env.MEMBER_TRAIT_ES_INDEX || 'member_trait',
43+
MEMBER_TRAIT_ES_TYPE: process.env.MEMBER_TRAIT_ES_TYPE || '_doc'
4044
},
4145

4246
// file upload max size in bytes

0 commit comments

Comments
 (0)