Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(identity): phase 2 #509

Merged
merged 47 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
04dbb39
Feat/login flow (#477)
alexanderleegs Sep 29, 2022
f46d58a
feat: collaborators (#510)
prestonlimlianjie Oct 4, 2022
9f11210
ref(services): migrate SitesService to TypeScript (#512)
dcshzj Oct 12, 2022
87b51ce
feat(rr): db migrations (#515)
seaerchin Oct 14, 2022
840997d
feat: introduce a new site info API endpoint (#513)
dcshzj Oct 14, 2022
5a8b9bb
feat: add collaborators statistics API endpoint (#520)
dcshzj Oct 14, 2022
ff57301
refactor: remove all usages of TokenStore and tests (#533)
dcshzj Oct 18, 2022
2730149
feat(rr): add database models (#518)
seaerchin Oct 20, 2022
e790ba5
feat: add new siteUrl API endpoint to get the production URL of site …
dcshzj Oct 20, 2022
ec885d0
Feat/notifications (#508)
alexanderleegs Oct 21, 2022
b93e81f
feat(rr): services + routes (#519)
seaerchin Oct 21, 2022
2e4eeb8
feat: add model and migration for review_request_views table (#521)
dcshzj Oct 21, 2022
f76920c
feat: add review request views API endpoint and functions (#532)
dcshzj Oct 21, 2022
428a5c0
fix(server): removed extra db assoc
seaerchin Oct 21, 2022
6ca7eee
fix(formsgsitecreation): removed extra prop
seaerchin Oct 21, 2022
1829408
Fix: reviewRequestId instead of reviewId
alexanderleegs Oct 21, 2022
ab0d59e
fix(server.js): add reviewrequestview init
seaerchin Oct 21, 2022
6d882c9
feat: add endpoint to mark a review request as viewed (#550)
dcshzj Oct 31, 2022
07bbb3f
Feat/comments (#534)
alexanderleegs Nov 2, 2022
fe818f0
feat(rr): adds be for unapproval of rr (#540)
seaerchin Nov 2, 2022
91c7028
fix: use review request requestor email for production commit email (…
dcshzj Nov 2, 2022
4f1e051
fix: include full model in order by due to presence of alias (#554)
dcshzj Nov 3, 2022
e723eae
fix(server): swap order for auth to avoid nemspace conflicts
seaerchin Nov 3, 2022
e1b1ba5
fix(review): allow rr creation by users of the site (#556)
seaerchin Nov 7, 2022
c7b11cb
tests: add remaining tests for identity features in SitesService (#566)
dcshzj Nov 10, 2022
b0076b0
chore(collaborators): update typings (#568)
seaerchin Nov 14, 2022
77d780d
tests: add unit tests for ReviewRequestService (#569)
dcshzj Nov 16, 2022
d9c6159
ref(fixtures): allow generating router for different user types (#574)
dcshzj Nov 22, 2022
3395f8e
Fix/reference sitename from repo (#577)
alexanderleegs Nov 29, 2022
84f2460
Feat/add middleware for verifying email user (#573)
alexanderleegs Nov 30, 2022
ef629a7
tests: add integration tests for review requests and comments (#576)
dcshzj Dec 8, 2022
84d81d3
fix(collaborators): add required middleware (#586)
seaerchin Dec 8, 2022
4d1ad02
tests: add unit tests for review requests routes (#582)
dcshzj Dec 9, 2022
bcfb368
feat(rr): blob diffs (#575)
seaerchin Dec 15, 2022
9c3dfaf
Feat/notifications tests (#514)
alexanderleegs Jan 5, 2023
5b0b819
Feat/generic notification creation (#523)
alexanderleegs Jan 17, 2023
5d7a08c
Vapt: merge back to tracking (#647)
alexanderleegs Mar 7, 2023
8c78060
Fix: rebase errors
alexanderleegs Mar 8, 2023
035181e
Fix: error message for review request
alexanderleegs Mar 8, 2023
3db9533
Fix: tests
alexanderleegs Mar 8, 2023
0ac21de
feat: use convict for env vars (#646)
harishv7 Mar 21, 2023
cf8a395
fix: make default empty strings (#658)
harishv7 Mar 21, 2023
50ae7dd
Fix/convict fixes (#660)
harishv7 Mar 23, 2023
99b5456
Chore/change node env of local dev to expect dev (#659)
alexanderleegs Mar 27, 2023
2df7746
Fix: change isSecure to variable instead of func (#664)
alexanderleegs Mar 27, 2023
d59f2d6
Fix/convict fixes (#663)
harishv7 Mar 28, 2023
29b1677
chore(package-lock): installed using old npm
seaerchin Mar 30, 2023
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
18 changes: 16 additions & 2 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
export CLIENT_ID=""
export CLIENT_SECRET=""
export REDIRECT_URI="http://localhost:8081/auth"
export REDIRECT_URI="http://localhost:8081/v1/auth"
export NODE_ENV="LOCAL_DEV"
export COOKIE_DOMAIN="localhost"
export AUTH_TOKEN_EXPIRY_DURATION_IN_MILLISECONDS=3600000
export SESSION_SECRET=mysessionsecretblah
export JWT_SECRET=mysecretblah
export ENCRYPTION_SECRET=anothersecretblah
export FRONTEND_URL='http://localhost:8081'
export GITHUB_ORG_NAME="isomerpages"
export GITHUB_BUILD_ORG_NAME="opengovsg"
export GITHUB_BUILD_REPO_NAME="isomer-build"
export MUTEX_TABLE_NAME=""
export MAX_NUM_OTP_ATTEMPTS=5
export OTP_EXPIRY=900000
export MUTEX_TABLE_NAME="mutex-table"

# GitHub access token to create repo
export SYSTEM_GITHUB_TOKEN=""
Expand All @@ -36,7 +40,6 @@ export DB_ENABLE_LOGGING=""

export LOCAL_SITE_ACCESS_TOKEN=""
export OTP_SECRET="dummysecret"
export DOMAIN_WHITELIST=".gov.sg"

# Email
export POSTMAN_API_KEY=""
Expand All @@ -48,3 +51,14 @@ export POSTMAN_SMS_CRED_NAME=""
export DD_ENV="local"
export DD_SERVICE="isomer"
export DD_TAGS="service:isomer"

# Cloudmersive
export CLOUDMERSIVE_API_KEY=""

# GitGuardian
export GITGUARDIAN_API_KEY=""

# SQS Queue
export INCOMING_QUEUE_URL="incoming"
export OUTGOING_QUEUE_URL="outgoing"
export SITE_LAUNCH_QUEUE_URL="site_launch"
44 changes: 41 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,58 @@ export FRONTEND_URL="http://localhost:3000"
export GITHUB_ORG_NAME="isomerpages"
export GITHUB_BUILD_ORG_NAME="opengovsg"
export GITHUB_BUILD_REPO_NAME="isomer-build"
export MUTEX_TABLE_NAME="mutex-table"
export ISOMERPAGES_REPO_PAGE_COUNT=3
export MAX_NUM_OTP_ATTEMPTS=5
export OTP_EXPIRY=900000
export SESSION_SECRET=blahblah

# GitHub access token to create repo
export SYSTEM_GITHUB_TOKEN="github_token"

# FormSG keys
export SITE_CREATE_FORM_KEY="site_form_key"

# Required to connect to DynamoDB
export AWS_ACCESS_KEY_ID="abc123"
export AWS_SECRET_ACCESS_KEY="xyz123"

# Required to run end-to-end tests
export E2E_TEST_REPO="e2e-test-repo"
export E2E_TEST_SECRET="test"
export E2E_TEST_GH_TOKEN="test"

# Database
export DB_URI="postgres://isomer:password@localhost:54321/isomercms_test"
export DB_MIN_POOL="1"
export DB_MAX_POOL="10"
export DB_ENABLE_LOGGING=""
export DB_ENABLE_LOGGING="true"

export LOCAL_SITE_ACCESS_TOKEN=""
export LOCAL_SITE_ACCESS_TOKEN="dummy"
export OTP_SECRET="dummysecret"
export DOMAIN_WHITELIST=".gov.sg"

# Email
export POSTMAN_API_KEY="some api key"

# SMS
export POSTMAN_SMS_CRED_NAME="isomer"

# Amplify
export AWS_REGION="ap-southeast-1"
export AWS_ACCOUNT_NUMBER="random"

# DataDog
export DD_ENV="local"
export DD_SERVICE="isomer"
export DD_TAGS="service:isomer"

# Cloudmersive
export CLOUDMERSIVE_API_KEY="cloudmersive"

# GitGuardian
export GITGUARDIAN_API_KEY="gitguardian"

# SQS Queue
export INCOMING_QUEUE_URL="incoming"
export OUTGOING_QUEUE_URL="outgoing"
export SITE_LAUNCH_QUEUE_URL="site_launch"
239 changes: 125 additions & 114 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,118 +1,129 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"jest": true,
"jest/globals": true
},
"extends": [
"airbnb-base",
"prettier",
"plugin:import/typescript"
],
"plugins": ["only-warn", "import", "jest"],
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"no-underscore-dangle": "off",
"class-methods-use-this": "off",
"import/no-unresolved": "error",
"import/extensions": ["warn", "never"],
"import/order": [
"error",
{
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always",
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object"],
"pathGroups": [{
"pattern": "@logger/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@errors/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@middleware/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@classes/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@routes/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@utils/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@validators/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@constants/**",
"group": "internal",
"position": "before"
}
]
}
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"jest": true,
"jest/globals": true
},
"extends": ["airbnb-base", "prettier", "plugin:import/typescript"],
"plugins": ["only-warn", "import", "jest"],
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"no-underscore-dangle": "off",
"class-methods-use-this": "off",
"import/no-unresolved": "error",
"import/extensions": ["warn", "never"],
"import/order": [
"error",
{
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always",
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object"
],
"jest/no-identical-title": "error"
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended"]
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
"alwaysTryTypes": true
},
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"alias": [
["@root", "."],
["@classes", "./classes"],
["@errors", "./errors"],
["@logger", "./logger"],
["@middleware", "./middleware"],
["@routes", "./routes"],
["@utils", "./utils"],
["@loaders", "./loaders"],
["@database", "./database"],
["@services", "./services"],
["@validators", "./validators"],
["@fixtures", "./fixtures"],
["@database", "./database"],
["@constants", "./constants"]
]
}
"pathGroups": [
{
"pattern": "@config/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@logger/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@errors/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@middleware/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@classes/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@routes/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@utils/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@validators/**",
"group": "internal",
"position": "before"
},
{
"pattern": "@constants/**",
"group": "internal",
"position": "before"
}
]
}
],
"jest/no-identical-title": "error"
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended"]
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"globals": {
"Base64": true
"import/resolver": {
"typescript": {
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
"alwaysTryTypes": true
},
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"alias": [
["@root", "."],
["@config", "./config"],
["@classes", "./classes"],
["@errors", "./errors"],
["@logger", "./logger"],
["@middleware", "./middleware"],
["@routes", "./routes"],
["@utils", "./utils"],
["@loaders", "./loaders"],
["@database", "./database"],
["@services", "./services"],
["@validators", "./validators"],
["@fixtures", "./fixtures"],
["@database", "./database"],
["@constants", "./constants"]
]
}
}
},
"globals": {
"Base64": true
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run dev:services
- run: . .env.test && npx jest
- run: . .env.test && npx jest --runInBand
- run: docker compose down

gatekeep:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build/
.DS_Store
.step-functions-local/
.serverless/
.cache_ggshield
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
source .env && ggshield secret scan pre-commit
Loading