Skip to content

Commit aebbb59

Browse files
Merge pull request #18 from topcoder-platform/es-updates
read challenges from ES
2 parents 5d0fb5e + bcdcfb7 commit aebbb59

9 files changed

+1336
-478
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ The following parameters can be set in config files or in env variables:
3030
- AMAZON.IS_LOCAL_DB: Use Amazon DynamoDB Local or server.
3131
- AMAZON.DYNAMODB_URL: The local url if using Amazon DynamoDB Local
3232
- AMAZON.ATTACHMENT_S3_BUCKET: the AWS S3 bucket to store attachments
33+
- ES: config object for Elasticsearch
34+
- ES.HOST: Elasticsearch host
35+
- ES.API_VERSION: Elasticsearch API version
36+
- ES.ES_INDEX: Elasticsearch index name
37+
- ES.ES_TYPE: Elasticsearch index type
3338
- FILE_UPLOAD_SIZE_LIMIT: the file upload size limit in bytes
3439
- CHALLENGES_API_URL: TC challenges API base URL
3540
- GROUPS_API_URL: TC groups API base URL
@@ -67,7 +72,7 @@ Go to `mock-api` folder and run command `npm run start` to start the mock-api li
6772
1. Drop/delete tables: `npm run drop-tables`
6873
2. Creating tables: `npm run create-tables`
6974
3. Seed/Insert data to tables: `npm run seed-tables`
70-
4. Initialize database in default environment: `npm run init-db`
75+
4. Initialize/Clear database in default environment: `npm run init-db`
7176
5. View table data in default environment: `npm run view-data <ModelName>`, ModelName can be `Challenge`, `ChallengeType`, `ChallengeSetting`, `AuditLog`, `Phase`, `TimelineTemplate`or `Attachment`
7277

7378
### Notes

config/default.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ module.exports = {
2929
ATTACHMENT_S3_BUCKET: process.env.ATTACHMENT_S3_BUCKET || 'my-testing-bucket-12345',
3030
S3_API_VERSION: process.env.S3_API_VERSION || '2006-03-01'
3131
},
32+
33+
ES: {
34+
// above AWS_REGION is used if we use AWS ES
35+
HOST: process.env.ES_HOST || 'localhost:9200',
36+
API_VERSION: process.env.ES_API_VERSION || '6.3',
37+
ES_INDEX: process.env.ES_INDEX || 'challenge',
38+
ES_TYPE: process.env.ES_TYPE || '_doc' // ES 6.x accepts only 1 Type per index and it's mandatory to define it
39+
},
40+
3241
// in bytes
3342
FILE_UPLOAD_SIZE_LIMIT: process.env.FILE_UPLOAD_SIZE_LIMIT
3443
? Number(process.env.FILE_UPLOAD_SIZE_LIMIT) : 50 * 1024 * 1024, // 50M

docs/swagger.yaml

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,39 +53,107 @@ paths:
5353
parameters:
5454
- $ref: '#/parameters/page'
5555
- $ref: '#/parameters/perPage'
56+
- name: id
57+
in: query
58+
description: Filter by id, exact match
59+
required: false
60+
type: string
61+
format: UUID
62+
- name: typeId
63+
in: query
64+
description: Filter by type id, exact match
65+
required: false
66+
type: string
67+
format: UUID
68+
- name: track
69+
in: query
70+
description: Filter by track, case-insensitive, partial matches are allowed.
71+
required: false
72+
type: string
5673
- name: name
5774
in: query
5875
description: Filter by name, case-insensitive, partial matches are allowed.
5976
required: false
6077
type: string
6178
- name: description
6279
in: query
63-
description: Filter by description. Partial matches are allowed.
80+
description: Filter by description, case-insensitive, partial matches are allowed.
81+
required: false
82+
type: string
83+
- name: timelineTemplateId
84+
in: query
85+
description: Filter by timeline template id, exact match
86+
required: false
87+
type: string
88+
format: UUID
89+
- name: reviewType
90+
in: query
91+
description: Filter by review type, case-insensitive, partial matches are allowed.
92+
required: false
93+
type: string
94+
- name: tag
95+
in: query
96+
description: Filter by tag name, case-insensitive, partial matches are allowed.
97+
required: false
98+
type: string
99+
- name: projectId
100+
in: query
101+
description: Filter by project id, exact match.
102+
required: false
103+
type: integer
104+
- name: forumId
105+
in: query
106+
description: Filter by forum id, exact match.
107+
required: false
108+
type: integer
109+
- name: legacyId
110+
in: query
111+
description: Filter by legacy id, exact match.
112+
required: false
113+
type: integer
114+
- name: status
115+
in: query
116+
description: Filter by status, case-insensitive, partial matches are allowed.
117+
required: false
118+
type: string
119+
enum: ['Draft', 'Canceled', 'Active', 'Completed']
120+
- name: group
121+
in: query
122+
description: Filter by group name, case-insensitive, partial matches are allowed.
64123
required: false
65124
type: string
66125
- name: createdDateStart
67126
in: query
68-
description: Filter by createdDate (lower bound of date range)
127+
description: Filter by created date (lower bound of date range)
69128
required: false
70129
type: string
130+
format: date-time
71131
- name: createdDateEnd
72132
in: query
73-
description: Filter by createdDate (upper bound of date range)
133+
description: Filter by created date (upper bound of date range)
74134
required: false
75135
type: string
136+
format: date-time
76137
- name: updatedDateStart
77138
in: query
78-
description: Filter by updatedDate (lower bound of date range)
139+
description: Filter by updated date (lower bound of date range)
79140
required: false
80141
type: string
142+
format: date-time
81143
- name: updatedDateEnd
82144
in: query
83-
description: Filter by updatedDate (upper bound of date range)
145+
description: Filter by updated date (upper bound of date range)
84146
required: false
85147
type: string
148+
format: date-time
86149
- name: createdBy
87150
in: query
88-
description: Filter by 'createdBy' field
151+
description: Filter by 'createdBy' field, case-insensitive, partial matches are allowed.
152+
required: false
153+
type: string
154+
- name: updatedBy
155+
in: query
156+
description: Filter by 'updatedBy' field, case-insensitive, partial matches are allowed.
89157
required: false
90158
type: string
91159
responses:

0 commit comments

Comments
 (0)