Skip to content

Commit

Permalink
Merge pull request #116 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
PROD deploy Jun 9
  • Loading branch information
jmgasper authored Jun 13, 2023
2 parents 1976ec4 + aceb6ce commit 3d5bc6c
Show file tree
Hide file tree
Showing 18 changed files with 554 additions and 96 deletions.
77 changes: 39 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
defaults: &defaults
docker:
- image: cimg/python:3.11.0-browsers
docker:
- image: cimg/python:3.11.0-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
Expand All @@ -13,7 +13,7 @@ install_dependency: &install_dependency
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.15 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand All @@ -23,58 +23,59 @@ restore_cache_settings_for_build: &restore_cache_settings_for_build
save_cache_settings: &save_cache_settings
key: docker-node-modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- node_modules

builddeploy_steps: &builddeploy_steps
- checkout
- setup_remote_docker
- run: *install_dependency
- run: *install_deploysuite
- run: ./build.sh ${APPNAME}
- deploy:
name: Running MasterScript.
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
- checkout
- setup_remote_docker
- run: *install_dependency
- run: *install_deploysuite
- run: ./build.sh ${APPNAME}
- deploy:
name: Running MasterScript.
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
jobs:
# Build & Deploy against development backend
"build-dev":
<<: *defaults
!!merge <<: *defaults
environment:
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "member-api-v5"
APPNAME: "member-api-v5"
steps: *builddeploy_steps

"build-prod":
<<: *defaults
!!merge <<: *defaults
environment:
DEPLOY_ENV: "PROD"
LOGICAL_ENV: "prod"
APPNAME: "member-api-v5"
LOGICAL_ENV: "prod"
APPNAME: "member-api-v5"
steps: *builddeploy_steps

workflows:
version: 2
build:
jobs:
# Development builds are executed on "develop" branch only.
- "build-dev":
context : org-global
filters:
branches:
only:
- develop
- feature/email
# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
context : org-global
filters:
branches:
only:
- master
# Development builds are executed on "develop" branch only.
- "build-dev":
context: org-global
filters:
branches:
only:
- develop
- feature/email
- feature/emsi_skills_search
# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
context: org-global
filters:
branches:
only:
- master
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.9.2
v12.22.12
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ The following parameters can be set in config files or in env variables:
- EMAIL_VERIFY_DISAGREE_URL: email verify disagree URL
- SCOPES: the configurable M2M token scopes, refer `config/default.js` for more details
- MEMBER_SECURE_FIELDS: Member profile identifiable info fields, only admin, M2M, or member himself can fetch these fields
- COMMUNICATION_SECURE_FIELDS: Member contact information, accessible by admins, managers, and copilots - anyone with a role in the AUTOCOMPLETE_ROLES array
- MEMBER_TRAIT_SECURE_FIELDS: Member traits identifiable info fields, only admin, M2M, or member himself can fetch these fields
- MISC_SECURE_FIELDS: Misc identifiable info fields, only admin, M2M, or member himself can fetch these fields
- SEARCH_SECURE_FIELDS: Member Search identifiable info fields, only admin, M2M, or member himself can fetch these fields
- STATISTICS_SECURE_FIELDS: Member Statistics identifiable info fields, only admin, M2M, or member himself can fetch these fields
- HEALTH_CHECK_TIMEOUT: health check timeout in milliseconds

Expand Down
7 changes: 6 additions & 1 deletion app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const MAMBO_GET_REWARDS_ALLOWED_FIELDS = [
'awardedOn', 'expiryOn', 'isExpired', 'id'
]

const BOOLEAN_OPERATOR = {
AND: 'AND',
OR: 'OR'
}
module.exports = {
ADMIN_ROLES,
SEARCH_BY_EMAIL_ROLES,
Expand All @@ -36,5 +40,6 @@ module.exports = {
EVENT_MIME_TYPE,
TOPICS,
ES_SEARCH_MAX_SIZE,
MAMBO_GET_REWARDS_ALLOWED_FIELDS
MAMBO_GET_REWARDS_ALLOWED_FIELDS,
BOOLEAN_OPERATOR
}
14 changes: 8 additions & 6 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,17 @@ module.exports = {
}
},


// Member identifiable info fields, copilots, admins, or M2M can get these fields
// Anyone in the constants.AUTOCOMPLETE_ROLES will have access to these fields
COMMUNICATION_SECURE_FIELDS: process.env.COMMUNICATION_SECURE_FIELDS
? process.env.COMMUNICATION_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email'],

// Member identifiable info fields, only admin, M2M, or member himself can get these fields
MEMBER_SECURE_FIELDS: process.env.MEMBER_SECURE_FIELDS
? process.env.MEMBER_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],
: ['addresses', 'createdBy', 'updatedBy'],

// Member traits identifiable info fields, only admin, M2M, or member himself can fetch these fields
MEMBER_TRAIT_SECURE_FIELDS: process.env.MEMBER_TRAIT_SECURE_FIELDS
Expand All @@ -103,11 +110,6 @@ module.exports = {
? process.env.MISC_SECURE_FIELDS.split(',')
: ['createdBy', 'updatedBy'],

// Member Search identifiable info fields, only admin, M2M, or member himself can fetch these fields
SEARCH_SECURE_FIELDS: process.env.SEARCH_SECURE_FIELDS
? process.env.SEARCH_SECURE_FIELDS.split(',')
: ['firstName', 'lastName', 'email', 'addresses', 'createdBy', 'updatedBy'],

// Member Statistics identifiable info fields, only admin, M2M, or member himself can fetch these fields
STATISTICS_SECURE_FIELDS: process.env.STATISTICS_SECURE_FIELDS
? process.env.STATISTICS_SECURE_FIELDS.split(',')
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ WORKDIR /member-api-v5
# Install the dependencies from package.json
RUN yarn

CMD yarn start
CMD node app.js
57 changes: 54 additions & 3 deletions docs/member-api.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"info": {
"_postman_id": "9f8d8103-0043-4959-b0cf-8e833845cc57",
"_postman_id": "515f8efb-72f4-4ccd-8a20-0543397f4e5c",
"name": "member-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "10740"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
Expand Down Expand Up @@ -7169,6 +7168,58 @@
}
},
"response": []
},
{
"name": "search all members - by skill",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/members/searchBySkills?skillId={{skill_id_1}}",
"host": [
"{{URL}}"
],
"path": [
"members",
"searchBySkills"
],
"query": [
{
"key": "skillId",
"value": "{{skill_id_1}}"
}
]
}
},
"response": []
},
{
"name": "search all members - by skills",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/members/searchBySkills?skillId={{skill_id_1}}&skillId={{skil_id_2}}",
"host": [
"{{URL}}"
],
"path": [
"members",
"searchBySkills"
],
"query": [
{
"key": "skillId",
"value": "{{skill_id_1}}"
},
{
"key": "skillId",
"value": "{{skil_id_2}}"
}
]
}
},
"response": []
}
],
"event": [
Expand Down
18 changes: 14 additions & 4 deletions docs/member-api.postman_environment.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "e4ccf752-810c-4a8d-9a72-9d8535ac20d8",
"id": "0ed61d4c-ecad-41b4-b29f-ca3086939151",
"name": "member-api",
"values": [
{
Expand Down Expand Up @@ -41,9 +41,19 @@
"key": "m2m_update",
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiZW5qdzE4MTBlRHozWFR3U08yUm4yWTljUVRyc3BuM0JAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTUwOTA2Mzg4LCJleHAiOjE2ODA5OTI3ODgsImF6cCI6ImVuancxODEwZUR6M1hUd1NPMlJuMlk5Y1FUcnNwbjNCIiwic2NvcGUiOiJ1cGRhdGU6bWVtYmVycyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.wImcvhkF9QPOCSEfZ01U-YxYM8NZi1yqgRmw3eiNn1Q",
"enabled": true
},
{
"key": "skill_id_1",
"value": "KS1200771D9CR9LB4MWW",
"enabled": true
},
{
"key": "skil_id_2",
"value": "KS121F45VPV8C9W3QFYH",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2020-02-14T13:59:07.169Z",
"_postman_exported_using": "Postman/7.13.0"
}
"_postman_exported_at": "2023-06-08T00:12:44.668Z",
"_postman_exported_using": "Postman/8.5.1"
}
90 changes: 89 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ info:
## Member Secure Fields
Member identifiable info fields, only admin, M2M, or member himself can get these fields - `firstName`, `lastName`, `email`, `addresses`, `createdBy`, `updatedBy`
Member identifiable info fields, only admin, M2M, or member himself can get these fields - `addresses`, `createdBy`, `updatedBy`
## Member Communication Fields
Member fields used for communication are accessible by managers, copilots, and admins. These include: `firstName`, `lastName`, `email`
## Member Traits Secure Fields
Expand Down Expand Up @@ -646,6 +650,90 @@ paths:
description: Internal server error
schema:
$ref: '#/definitions/ErrorModel'
'/members/searchBySkills':
get:
tags:
- Search
description:
Search members by EMSI skill id(s) provided. This API is used for the talent search. By default, the results are sorted by the number of challenges won.
parameters:
- name: skillID
in: query
required: true
type: string
description: >
skillId=skillID1&skillId=skillID2
EMSI skill id(s) to use when filtering members. Members who match all of the skill IDs provided will be returned.
- name: fields
in: query
required: false
type: string
description: >
fields=fieldName1,fieldName2,...,fieldN
parameter for choosing which fields of members profile that will be included in response.
+ userId - Select the field userId
+ handle - Select the field handle
+ firstName - Select the field firstName
+ lastName - Select the field lastName
- $ref: '#/parameters/page'
- $ref: '#/parameters/perPage'
- name: sortOrder
in: query
required: false
type: string
description: sort by asc or desc
- name: sortBy
in: query
required: false
type: string
description: Field to sort by. Options include 'userId', 'country', 'handle', 'firstName', 'lastName', 'numberOfChallengesWon', 'numberOfChallengesPlaced'
responses:
'200':
description: OK
schema:
type: array
items:
$ref: '#/definitions/MemberSearchDataItem'
headers:
X-Next-Page:
type: integer
description: The index of the next page
X-Page:
type: integer
description: The index of the current page (starting at 1)
X-Per-Page:
type: integer
description: The number of items to list per page
X-Prev-Page:
type: integer
description: The index of the previous page
X-Total:
type: integer
description: The total number of items
X-Total-Pages:
type: integer
description: The total number of pages
Link:
type: string
description: Pagination link header.
'400':
description: Bad request data
schema:
$ref: '#/definitions/ErrorModel'
'403':
description: No permission to access the API
schema:
$ref: '#/definitions/ErrorModel'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorModel'
'/members/{handle}/traits':
get:
tags:
Expand Down
Loading

0 comments on commit 3d5bc6c

Please sign in to comment.