Skip to content

Commit 47bb59f

Browse files
authored
Merge pull request #581 from topcoder-platform/dev
refactor: revamp to use data access layer
2 parents a49c6fd + 90514c2 commit 47bb59f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+6468
-10922
lines changed

.circleci/config.yml

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
defaults: &defaults
3-
docker:
4-
- image: cimg/python:3.11.0-browsers
3+
docker:
4+
- image: cimg/python:3.11.0-browsers
55
install_dependency: &install_dependency
66
name: Installation of build and deployment dependencies.
77
command: |
@@ -13,7 +13,7 @@ install_dependency: &install_dependency
1313
install_deploysuite: &install_deploysuite
1414
name: Installation of install_deploysuite.
1515
command: |
16-
git clone --branch v1.4 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
16+
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
1717
cp ./../buildscript/master_deploy.sh .
1818
cp ./../buildscript/buildenv.sh .
1919
cp ./../buildscript/awsconfiguration.sh .
@@ -23,60 +23,77 @@ restore_cache_settings_for_build: &restore_cache_settings_for_build
2323
save_cache_settings: &save_cache_settings
2424
key: docker-node-modules-{{ checksum "yarn.lock" }}
2525
paths:
26-
- node_modules
26+
- node_modules
2727

2828
builddeploy_steps: &builddeploy_steps
29-
- checkout
30-
- setup_remote_docker
31-
- run: *install_dependency
32-
- run: *install_deploysuite
33-
- restore_cache: *restore_cache_settings_for_build
34-
- run: ./build.sh ${APPNAME}
35-
- save_cache: *save_cache_settings
36-
- deploy:
37-
name: Running MasterScript.
38-
command: |
39-
./awsconfiguration.sh $DEPLOY_ENV
40-
source awsenvconf
41-
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
42-
source buildenvvar
43-
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
44-
45-
29+
- checkout
30+
- setup_remote_docker
31+
- run: *install_dependency
32+
- run: *install_deploysuite
33+
- restore_cache: *restore_cache_settings_for_build
34+
- run:
35+
name: "Authenticate with CodeArtifact and build docker image"
36+
command: "./awsconfiguration.sh ${CODEARTIFACT_ENV}\nsource awsenvconf\naws codeartifact login --tool npm --repository topcoder-framework --domain topcoder --domain-owner $AWS_ACCOUNT_ID --region $AWS_REGION --namespace @topcoder-framework\ncp ~/.npmrc .\nrm -f awsenvconf \n./build.sh ${APPNAME}\n"
37+
- save_cache: *save_cache_settings
38+
- deploy:
39+
name: Running MasterScript.
40+
command: |
41+
./awsconfiguration.sh $DEPLOY_ENV
42+
source awsenvconf
43+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
44+
source buildenvvar
45+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
4646
jobs:
4747
# Build & Deploy against development backend
4848
"build-dev":
49-
<<: *defaults
49+
!!merge <<: *defaults
5050
environment:
5151
DEPLOY_ENV: "DEV"
5252
LOGICAL_ENV: "dev"
53-
APPNAME: "challenge-api"
53+
APPNAME: "challenge-api"
54+
CODEARTIFACT_ENV: "PROD"
55+
steps: *builddeploy_steps
56+
57+
"build-qa":
58+
!!merge <<: *defaults
59+
environment:
60+
DEPLOY_ENV: "QA"
61+
LOGICAL_ENV: "qa"
62+
APPNAME: "challenge-api"
63+
CODEARTIFACT_ENV: "PROD"
5464
steps: *builddeploy_steps
5565

5666
"build-prod":
57-
<<: *defaults
67+
!!merge <<: *defaults
5868
environment:
5969
DEPLOY_ENV: "PROD"
60-
LOGICAL_ENV: "prod"
61-
APPNAME: "challenge-api"
70+
LOGICAL_ENV: "prod"
71+
APPNAME: "challenge-api"
6272
steps: *builddeploy_steps
6373

6474
workflows:
6575
version: 2
6676
build:
6777
jobs:
68-
# Development builds are executed on "develop" branch only.
69-
- "build-dev":
70-
context : org-global
71-
filters:
72-
branches:
73-
only:
74-
- dev
78+
# Development builds are executed on "develop" branch only.
79+
- "build-dev":
80+
context: org-global
81+
filters:
82+
branches:
83+
only:
84+
- dev
85+
86+
- "build-qa":
87+
context: org-global
88+
filters:
89+
branches:
90+
only:
91+
- refactor/domain-challenge
7592

76-
# Production builds are exectuted only on tagged commits to the
77-
# master branch.
78-
- "build-prod":
79-
context : org-global
80-
filters:
81-
branches:
82-
only: master
93+
# Production builds are exectuted only on tagged commits to the
94+
# master branch.
95+
- "build-prod":
96+
context: org-global
97+
filters:
98+
branches:
99+
only: master

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ logs
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7+
.yarn
78

89
# Runtime data
910
pids
@@ -60,4 +61,5 @@ typings/
6061

6162
# next.js build output
6263
.next
64+
ecr-login.sh
6365
.npmrc

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"printWidth": 100
3+
}

.vscode/settings.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"editor.defaultFormatter": "standard.vscode-standard",
3-
"standard.autoFixOnSave": true
4-
}
2+
"standard.autoFixOnSave": true,
3+
"[javascript]": {
4+
"editor.defaultFormatter": "esbenp.prettier-vscode"
5+
}
6+
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ The following parameters can be set in config files or in env variables:
5858
- ES.HOST: Elasticsearch host
5959
- ES.API_VERSION: Elasticsearch API version
6060
- ES.ES_INDEX: Elasticsearch index name
61-
- ES.ES_TYPE: Elasticsearch index type
6261
- ES.ES_REFRESH: Elasticsearch refresh method. Default to string `true`(i.e. refresh immediately)
6362
- FILE_UPLOAD_SIZE_LIMIT: the file upload size limit in bytes
6463
- RESOURCES_API_URL: TC resources API base URL

app-bootstrap.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* App bootstrap
33
*/
4-
global.Promise = require('bluebird')
5-
const Joi = require('joi')
4+
global.Promise = require("bluebird");
5+
const Joi = require("joi");
66

7-
Joi.optionalId = () => Joi.string().uuid()
8-
Joi.id = () => Joi.optionalId().required()
9-
Joi.page = () => Joi.number().integer().min(1).default(1)
10-
Joi.perPage = () => Joi.number().integer().min(1).max(100).default(20)
11-
Joi.fileSize = () => Joi.number().integer().min(0).default(0)
7+
Joi.optionalId = () => Joi.string().uuid();
8+
Joi.id = () => Joi.optionalId().required();
9+
Joi.page = () => Joi.number().integer().min(1).default(1);
10+
Joi.perPage = () => Joi.number().integer().min(1).max(100).default(20);
11+
Joi.fileSize = () => Joi.number().integer().min(0).default(0);

0 commit comments

Comments
 (0)