Skip to content

Commit cbd5521

Browse files
zhijiezhijie
authored andcommitted
final fix from updating GroupResource with TypeScript and Postgres
1 parent cac55b9 commit cbd5521

Some content is hidden

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

45 files changed

+16002
-1402
lines changed

.DS_Store

6 KB
Binary file not shown.

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Dockerfile
2+
deployment/
3+
docker-compose.yml
4+
scripts/
5+
.circleci/
6+
old_stuff/

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.env.sample

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# ========================================
2+
# APPLICATION PORT
3+
# ========================================
4+
PORT=3000
5+
6+
# ========================================
7+
# POSTGRESQL DATABASES
8+
# ========================================
9+
10+
# --- Connection Details ---
11+
# Used by the application and migration script
12+
DB_USERNAME=topcoderuser
13+
DB_PASSWORD=randompassword
14+
DB_HOST=127.0.0.1
15+
DB_PORT=5432
16+
17+
# --- Database Names ---
18+
# Used by the application, migration script, and docker init script
19+
COMMON_OLTP_DB_NAME=common_oltp_db
20+
AUTHORIZATION_DB_NAME=authorization_db
21+
22+
# --- Full Connection URLs (Primarily for Prisma Migrations/Studio) ---
23+
# Note: These are NOT directly used by the migration script anymore,
24+
# but are kept for standard Prisma tooling (e.g., migrate, studio).
25+
# The migration script now constructs the URL from the components above.
26+
COMMON_OLTP_DB_URL="postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${COMMON_OLTP_DB_NAME}?sslmode=disable&schema=common_oltp"
27+
AUTHORIZATION_DB_URL="postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${AUTHORIZATION_DB_NAME}?sslmode=disable"
28+
29+
# ========================================
30+
# MYSQL LEGACY AUTH DB (Source for Migration)
31+
# ========================================
32+
# Used by the migration script
33+
MYSQL_HOST=127.0.0.1
34+
MYSQL_PORT=3306 # Port exposed on the host by docker-compose
35+
MYSQL_USER=mysql-user # User created in the MySQL container
36+
MYSQL_PASSWORD=mysql-password # Password for MYSQL_USER
37+
MYSQL_DATABASE=authorization_db # DB name inside the MySQL container
38+
MYSQL_ROOT_PASSWORD=mysql-user-root-password # Root password for MySQL container (used for import)
39+
40+
# ========================================
41+
# REDIS CACHE
42+
# ========================================
43+
REDIS_HOST=127.0.0.1
44+
REDIS_PORT=6379
45+
# REDIS_PASSWORD= # Uncomment and set if password protection is enabled
46+
# REDIS_DB=0 # Optional: default Redis DB index
47+
48+
# ========================================
49+
# JWT VALIDATION (Incoming User Requests)
50+
# ========================================
51+
52+
# Validation Mode:
53+
# HS256: Use for local development with tokens generated using AUTH_SECRET.
54+
# RS256: Use for production/staging with tokens from an external IdP (e.g., Auth0) using JWKS.
55+
JWT_VALIDATION_MODE=HS256
56+
57+
# --- HS256 Settings (if JWT_VALIDATION_MODE=HS256) ---
58+
# Used by jwt.strategy.ts and local token generation script
59+
# IMPORTANT: Replace with a strong, unique secret key in your actual .env file if using HS256
60+
AUTH_SECRET="your-local-dev-secret-key-placeholder"
61+
# Optional: Set to match the issuer/audience in your HS256 tokens for stricter validation
62+
JWT_ISSUER_URL="https://api.topcoder-dev.com"
63+
JWT_AUDIENCE="www.example.com"
64+
65+
# --- RS256 Settings (if JWT_VALIDATION_MODE=RS256) ---
66+
# Used by jwt.strategy.ts if mode is RS256
67+
# Ensure this matches the 'iss' claim in the JWTs from your IdP (e.g., Auth0)
68+
# JWT_ISSUER_URL="https://topcoder-dev.auth0.com/"
69+
# Ensure this matches the 'aud' claim (audience) the JWTs are intended for (your API identifier in IdP)
70+
# JWT_AUDIENCE="https://api.topcoder-dev.com/v5"
71+
# JWKS URI from your IdP (often found at ${JWT_ISSUER_URL}.well-known/jwks.json)
72+
# JWT_JWKS_URI="https://topcoder-dev.auth0.com/.well-known/jwks.json"
73+
74+
# ========================================
75+
# M2M AUTHENTICATION (Service-to-Service)
76+
# ========================================
77+
# Used for authenticating outgoing requests (e.g., to Event Bus)
78+
79+
# --- Auth0 Client Credentials Example ---
80+
# Replace with your actual Auth0 Machine-to-Machine application details
81+
AUTH0_URL="https://topcoder-dev.auth0.com/oauth/token" # Your Auth0 domain
82+
AUTH0_AUDIENCE="https://m2m.topcoder-dev.com/" # API Audience for M2M
83+
AUTH0_CLIENT_ID="jGIf2pd3f44B1jqvOai30BIKTZanYBfU" # Client ID of M2M App
84+
AUTH0_CLIENT_SECRET="change-me" # Client Secret of M2M App
85+
# Optional: URL of proxy server if needed for token fetching
86+
#AUTH0_PROXY_SERVER_URL=
87+
# Optional: Token cache expiry time in minutes (used by M2M client)
88+
TOKEN_CACHE_TIME=1440 # Example: 24 hours
89+
90+
# ========================================
91+
# EVENT BUS SERVICE
92+
# ========================================
93+
BUSAPI_URL="https://api.topcoder-dev.com/v5" # Example URL - REPLACE IF NEEDED
94+
KAFKA_ERROR_TOPIC="common.error.reporting"
95+
# ========================================
96+
# MEMBER SERVICE
97+
# ========================================
98+
MEMBER_API_URL=https://api.topcoder-dev.com/v5/members
99+
# ========================================
100+
# ROLE CONFIGURATION
101+
# ========================================
102+
ADMIN_ROLE_NAME="administrator" # The name of the admin role in the 'authorization_db' Role table
103+
104+
# ========================================
105+
# EXTERNAL APIS / MISC
106+
# ========================================
107+
TOPCODER_API_BASE_URL="https://api.topcoder-dev.com/v5"
108+
109+
# ========================================
110+
# DICE/SLACK
111+
# ========================================
112+
113+
DICEAUTH_DICE_API_URL="https://console-api-uat.diceid.com/v1"
114+
DICEAUTH_DICE_API_KEY="api-key"
115+
DICEAUTH_ORG_ID="4f541723-f581-44de-b61c-5f83e8b8ef1e"
116+
DICEAUTH_USER_ID="a5e7e72a-fa5e-4acf-9eca-741d1443279b"
117+
DICEAUTH_TC_API_KEY="api-key"
118+
DICEAUTH_SCHEMA_NAME="Topcoder"
119+
DICEAUTH_SCHEMA_VERSION="1.4"
120+
DICEAUTH_OTP_DURATION="10"
121+
SLACK_BOT_KEY="key"
122+
SLACK_CHANNEL_ID="C04ENKCU4TZ"
123+
124+
# ========================================
125+
# AUTHENTICATION
126+
# ========================================
127+
JWT_SECRET="my-secret"
128+
129+
130+
# Legacy Blowfish Encryption Key (Base64 Encoded - !!! REPLACE WITH ACTUAL KEY FROM OLD SYSTEM !!!)
131+
# Used for compatibility with the old password encoding scheme.
132+
LEGACY_BLOWFISH_KEY=!!!_REPLACE_WITH_BASE64_ENCODED_KEY_!!!
133+
134+
## SENDGRID
135+
SENDGRID_RESEND_ACTIVATION_EMAIL_TEMPLATE_ID="d-73c29be82bfa4d68beea2208b6a3c4b2"
136+
SENDGRID_WELCOME_EMAIL_TEMPLATE_ID="d-26c8962fb48c42a3997053ebe5954516"
137+
138+
SSO_TOKEN_SALT=change-me

.gitignore

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
old_stuff/
66+
67+
# Optional REPL history
68+
.node_repl_history
69+
70+
# Output of 'npm pack'
71+
*.tgz
72+
73+
# Yarn Integrity file
74+
.yarn-integrity
75+
76+
# dotenv environment variables file
77+
.env
78+
.env*.local
79+
.env.development.local
80+
.env.test.local
81+
.env.production.local
82+
83+
# parcel-bundler cache (https://parceljs.org/)
84+
.cache
85+
.parcel-cache
86+
87+
# Next.js build output
88+
.next
89+
out
90+
91+
# Nuxt.js build output
92+
.nuxt
93+
dist
94+
95+
# Nuxt.js generated files/directories
96+
.output/
97+
98+
# VuePress output directory
99+
.vuepress/dist
100+
101+
# Serverless directories
102+
.serverless/
103+
104+
# FuseBox cache
105+
.fusebox/
106+
107+
# DynamoDB Local files
108+
.dynamodb/
109+
110+
# TernJS port file
111+
.tern-port
112+
113+
# Stores VSCode versions used for testing VSCode extensions
114+
.vscode-test
115+
116+
# Gatsby files
117+
.cache/
118+
# Comment in the next line if you don't want to check in Gatsby's public directory
119+
# public
120+
121+
.forestry/
122+
123+
# Compiled output
124+
dist
125+
build
126+
out
127+
128+
# Prisma
129+
prisma/generated
130+
prisma/migrations/*/*.sql
131+
132+
# IDE files
133+
.idea
134+
.vscode
135+
136+
# Postman
137+
newman-report.json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.13.1

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

0 commit comments

Comments
 (0)