Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7e1f9ef
#193 - Add new submittedDate and reviewedDate attributes to the models
callmekatootie Sep 18, 2020
26ffa92
#193 - housekeeping
callmekatootie Sep 18, 2020
0bde633
#193 - Even for non admin users, set the new attribute value
callmekatootie Sep 18, 2020
be156cc
Merge pull request #198 from topcoder-platform/Issue_193
cwdcwd Sep 21, 2020
36b8917
Trigger CI build
callmekatootie Sep 23, 2020
ed5a40d
Removing health check
rootelement Sep 23, 2020
fbdd04f
updating deploy script version
cwdcwd Sep 23, 2020
c502781
Fix issue where unregistered members could submit for a challenge
callmekatootie Oct 27, 2020
f938a7d
Update config.yml
Gunasekar-K Oct 30, 2020
24e2307
Undo changes of commit https://github.com/topcoder-platform/submissio…
callmekatootie Jan 29, 2021
31a8527
Merge branch 'develop' of github.com:topcoder-platform/submissions-ap…
callmekatootie Jan 29, 2021
c0bb93b
migration to v5
Sande3p Feb 1, 2021
05a464a
just verfiying the branch on dev env
Feb 3, 2021
a0a788b
migration to v5 API
mark-nakachon Feb 3, 2021
737b9d3
Merge branch 'develop-temp' into develop
mark-nakachon Feb 4, 2021
fa71ad5
Merge pull request #206 from mark-nakachon/develop
Sande3p Feb 4, 2021
294df45
reverted to fetch legacy-id code
Feb 5, 2021
a6ee3c0
deploying feature/shapeup-pure-v5-task branch for testing
Feb 5, 2021
03c56a6
typo
Feb 5, 2021
5c83c09
reverting schema validation too
Feb 5, 2021
fc9184d
getting v5 challenge id from legeacy id
Feb 7, 2021
8a1d6e4
#209 - npm script to store v5 challenge id for submissions
callmekatootie Feb 10, 2021
219acd2
#210 - Swap challenge id details when responding to api request or po…
callmekatootie Feb 10, 2021
cc57dc7
Update config.yml
Feb 10, 2021
7aa8f3d
Set schema for challenge id
callmekatootie Feb 11, 2021
984962b
Merge pull request #208 from topcoder-platform/feature/shapeup-pure-v…
Feb 11, 2021
6be540c
Fix issue where after v5 migration, search query would not return any…
callmekatootie Feb 11, 2021
a7c441f
Output ES query for debug
callmekatootie Feb 11, 2021
2374b05
fixing logging issue
Feb 11, 2021
e4db230
#214 - Fix issue where db to es migration script did not migrate all …
callmekatootie Feb 12, 2021
c5a73db
Merge branch 'develop' of github.com:topcoder-platform/submissions-ap…
callmekatootie Feb 12, 2021
82ee6ee
#214 - use bulk api for migrating db to es
callmekatootie Feb 12, 2021
792ef76
Debug update challenge id script
callmekatootie Feb 25, 2021
2fd86b5
remove debug statements
callmekatootie Feb 25, 2021
89a87b1
Merge pull request #219 from topcoder-platform/Issue_218
Feb 25, 2021
e372de7
Do not update record unnecessarily
callmekatootie Feb 25, 2021
59d78b1
#221 - Script to update current challenge id to v5 challenge id in su…
callmekatootie Feb 28, 2021
4b0a704
Merge pull request #222 from topcoder-platform/Issue_221
Feb 28, 2021
b0328d9
#223 - New script to update legacy challenge id, with filter in code …
callmekatootie Feb 28, 2021
11f64d0
Merge pull request #224 from topcoder-platform/Issue_223
Feb 28, 2021
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
23 changes: 8 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
version: 2
defaults: &defaults
docker:
- image: docker:18.06.0-ce-git
- image: circleci/python:stretch-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
apk update
apk add --no-cache bash
apk add --no-cache jq py-pip sudo curl
apk upgrade
apk add py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
pip install --upgrade pip
sudo pip install awscli --upgrade
sudo curl -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest
sudo pip install docker-compose
sudo chmod +x /usr/local/bin/ecs-cli
name: Installation of build and deployment dependencies.
command: |
sudo apt install jq
sudo pip3 install awscli --upgrade
sudo pip3 install docker-compose

install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.1 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand Down Expand Up @@ -79,4 +72,4 @@ workflows:
context : org-global
filters:
branches:
only: master
only: master
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ Please ensure to create the index `submission-test` or the index specified in th
export ES_INDEX=submission-test
```


#### Running unit tests and coverage

To run unit tests alone
Expand Down Expand Up @@ -172,6 +171,26 @@ To migrate the existing data from DynamoDB to ES, run the following script
npm run db-to-es
```

#### Store v5 challenge id for current records

Submission API started off using the legacy challenge ids. With the v5 upgrade to the challenge api, we now need to make use of the v5 challenge ids. We have thus created a script to update existing `challengeId` attribute on submissions to v5 and store the older challenge ids in the `legacyChallengeId` attribute.

To update the existing challengeId data on submissions in DynamoDB to v5 challengeId, set the following env variables:

```bash
SUBMISSION_TABLE_NAME // Table name of the submission records. Defaults to 'Submission'
UPDATE_V5_CHALLENGE_BATCH_SIZE // Number of records that are updated simultaneously. Defaults to 250
FETCH_CREATED_DATE_START // The start day of fetch latest challenges. Defaults to '2021-01-01'
FETCH_PAGE_SIZE // The page size of each api request. Defaults to 500
```


and then run the following script

```
npm run update-to-v5-challengeId
```

#### Swagger UI

Swagger UI will be served at `http://localhost:3000/docs`
Expand Down
8 changes: 6 additions & 2 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module.exports = {
BUSAPI_URL: process.env.BUSAPI_URL || 'https://api.topcoder-dev.com/v5',
KAFKA_ERROR_TOPIC: process.env.KAFKA_ERROR_TOPIC || 'error.notification',
KAFKA_AGGREGATE_TOPIC: process.env.KAFKA_AGGREGATE_TOPIC || 'submission.notification.aggregate',
CHALLENGEAPI_URL: process.env.CHALLENGEAPI_URL || 'https://api.topcoder-dev.com/v4/challenges',
CHALLENGEAPI_V5_URL: process.env.CHALLENGEAPI_V5_URL || 'https://api.topcoder-dev.com/v5/challenges',
RESOURCEAPI_V5_BASE_URL: process.env.RESOURCEAPI_V5_BASE_URL || 'https://api.topcoder-dev.com/v5',
AUTH0_URL: process.env.AUTH0_URL, // Auth0 credentials for Submission Service
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE || 'https://www.topcoder.com',
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
Expand All @@ -37,5 +37,9 @@ module.exports = {
PAGE_SIZE: process.env.PAGE_SIZE || 20,
MAX_PAGE_SIZE: parseInt(process.env.MAX_PAGE_SIZE) || 100,
ES_BATCH_SIZE: process.env.ES_BATCH_SIZE || 250,
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL
UPDATE_V5_CHALLENGE_BATCH_SIZE: process.env.UPDATE_V5_CHALLENGE_BATCH_SIZE || 100,
SUBMISSION_TABLE_NAME: process.env.SUBMISSION_TABLE_NAME || 'Submission',
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
FETCH_CREATED_DATE_START: process.env.FETCH_CREATED_DATE_START || '2021-01-01',
FETCH_PAGE_SIZE: process.env.FETCH_PAGE_SIZE || 500
}
8 changes: 4 additions & 4 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
LOG_LEVEL: 'info',
WEB_SERVER_PORT: 3010,
AUTH_SECRET: 'mysecret',
VALID_ISSUERS: '["https://api.topcoder.com"]',
VALID_ISSUERS: process.env.VALID_ISSUERS ? process.env.VALID_ISSUERS.replace(/\\"/g, '') : '["https://api.topcoder.com","https://topcoder-dev.auth0.com/"]',
API_VERSION: process.env.API_VERSION || '/api/v5',
aws: {
AWS_REGION: process.env.AWS_REGION || 'us-east-1', // AWS Region to be used by the application
Expand All @@ -16,14 +16,14 @@ module.exports = {
S3_BUCKET: process.env.S3_BUCKET_TEST || 'tc-testing-submissions' // S3 Bucket to which submissions need to be uploaded
},
BUSAPI_EVENTS_URL: 'https://api.topcoder-dev.com/v5/bus/events',
CHALLENGEAPI_URL: 'https://api.topcoder-dev.com/v4/challenges',
BUSAPI_URL: 'https://api.topcoder-dev.com/v5',
CHALLENGEAPI_V5_URL: 'https://api.topcoder-dev.com/v5/challenges',
esConfig: {
ES_INDEX: process.env.ES_INDEX_TEST || 'submission-test',
ES_TYPE: process.env.ES_TYPE_TEST || '_doc' // ES 6.x accepts only 1 Type per index and it's mandatory to define it
},
AUTH0_URL: process.env.AUTH0_URL, // Auth0 credentials for Submission Service
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE || 'https://www.topcoder.com',
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
USER_TOKEN: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLmNvbSIsImhhbmRsZSI6IlNoYXJhdGhrdW1hcjkyIiwiZXhwIjo1NTUzMDE5OTI1OSwidXNlcklkIjoiNDA0OTMwNTAiLCJpYXQiOjE1MzAxOTg2NTksImVtYWlsIjoiU2hhcmF0aGt1bWFyOTJAdG9wY29kZXIuY29tIiwianRpIjoiYzNhYzYwOGEtNTZiZS00NWQwLThmNmEtMzFmZTk0Yjk1NjFjIn0.2gtNJwhcv7MYc-muX3Nv-B0RdWbhMRl7-xrwFUsLazM',
Expand Down
31 changes: 31 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ paths:
legacySubmissionId: 'a12a4180-65aa-42ec-a945-5fd21dec0502'
legacyUploadId: 'a12a4180-65aa-42ec-a945-5fd21dec0502'
submissionPhaseId: 764567
submittedDate: '2018-05-20T07:00:30.123Z'
created: '2018-05-20T07:00:30.123Z'
updated: '2018-06-01T07:36:28.178Z'
createdBy: 'topcoder user'
Expand All @@ -107,6 +108,7 @@ paths:
legacySubmissionId: 'a12a4180-65aa-42ec-a945-5fd21dec0502'
legacyUploadId: 'a12a4180-65aa-42ec-a945-5fd21dec0502'
submissionPhaseId: 764567
submittedDate: '2018-05-20T08:00:30.000Z'
created: '2018-05-20T08:00:30.000Z'
updated: '2018-06-01T09:23:00.178Z'
createdBy: 'topcoder user'
Expand Down Expand Up @@ -205,6 +207,7 @@ paths:
Create a new submission.

**Authorization:** Submission creation is accessible by roles `topcoder user`, `admin` and `copilot`.
**Note** Value for `submittedDate` attribute can only be provided by users with `admin` role
tags:
- Submissions
operationId: createSubmission
Expand Down Expand Up @@ -262,6 +265,11 @@ paths:
name: submissionPhaseId
type: integer
description: Submission Phase Id
- in: formData
name: submittedDate
type: string
format: date-time
description: Date of submission (defaults to submission creation date if none passed)
responses:
201:
description: Created - The request was successful and the resource is returned.
Expand Down Expand Up @@ -612,6 +620,7 @@ paths:
scoreCardId: 123456789
isPassing: false
isFinal: false
reviewedDate: '2018-05-20T07:00:30.123Z'
created: '2018-05-20T07:00:30.123Z'
updated: '2018-06-01T07:36:28.178Z'
createdBy: copilot
Expand All @@ -622,6 +631,7 @@ paths:
scoreCardId: 123456789
isPassing: true
isFinal: true
reviewedDate: '2018-05-20T07:00:30.123Z'
created: '2018-05-20T07:00:30.123Z'
updated: '2018-06-01T07:36:28.178Z'
createdBy: copilot
Expand Down Expand Up @@ -718,6 +728,8 @@ paths:
Create a new review summation.

**Authorization:** Review summation creation is accessible by roles `admin` and `copilot`.

**Note** Value for `reviewedDate` attribute can only be provided by users with `admin` role
tags:
- 'Review summations'
operationId: createReviewSummation
Expand Down Expand Up @@ -931,6 +943,7 @@ paths:
scoreCardId: 123456789
submissionId: 'd67a4180-65aa-42ec-a945-5fd21dec0503'
status: 'queued'
reviewedDate: '2018-05-20T07:00:30.123Z'
created: '2018-05-20T07:00:30.123Z'
updated: '2018-06-01T07:36:28.178Z'
createdBy: 'admin'
Expand All @@ -942,6 +955,7 @@ paths:
scoreCardId: 123456789
submissionId: 'd23a4180-65aa-42ec-a945-5fd21dec0503'
status: 'completed'
reviewedDate: '2018-05-20T07:00:30.123Z'
created: '2018-05-20T07:00:30.123Z'
updated: '2018-06-01T07:36:28.178Z'
createdBy: 'admin'
Expand Down Expand Up @@ -1038,6 +1052,8 @@ paths:
Create a new review.

**Authorization:** Review creation is accessible by roles `admin` and `copilot`.

**Note** Value for `reviewedDate` attribute can only be provided by users with `admin` role
tags:
- 'Reviews'
operationId: createReview
Expand Down Expand Up @@ -1880,6 +1896,11 @@ definitions:
type: integer
description: The submission phase id.
example: '5dea6d9e-161a-4c7a-b316-597c73a7b8f4'
submittedDate:
type: string
format: date-time
description: Date of submission (defaults to submission creation date if none passed)
example: '2018-05-20T07:00:30.123Z'

UpdatableSubmission:
description: The submission entity fields that updates whole entity.
Expand Down Expand Up @@ -1939,6 +1960,11 @@ definitions:
metadata:
type: object
description: Review summation metadata in JSON format
reviewedDate:
type: string
format: date-time
description: Date of review summation (defaults to review summation creation date if none passed)
example: '2018-05-20T07:00:30.123Z'

UpdatableReviewSummation:
description: The review summation entity fields that updates whole entity.
Expand Down Expand Up @@ -2006,6 +2032,11 @@ definitions:
metadata:
type: object
description: Review Metadata in JSON format
reviewedDate:
type: string
format: date-time
description: Date of review (defaults to review creation date if none passed)
example: '2018-05-20T07:00:30.123Z'

UpdatableReview:
description: The review entity fields that updates whole entity.
Expand Down
Loading