Skip to content

Commit

Permalink
Merge pull request #53 from crazyoptimist/feat/rbac-with-casl
Browse files Browse the repository at this point in the history
Feat: Implemented claim based authorization with CASL
  • Loading branch information
crazyoptimist authored May 31, 2024
2 parents 978f5db + fde5d6b commit 5a515c9
Show file tree
Hide file tree
Showing 18 changed files with 531 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ DB_USERNAME=nest
DB_PASSWORD=nest
DB_DATABASE=nest
DB_SYNC=false

# REDIS
REDIS_HOST=localhost
REDIS_PORT=6379
15 changes: 15 additions & 0 deletions deployments/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
- DB_PASSWORD=${DB_PASSWORD}
- DB_DATABASE=${DB_DATABASE}
- DB_SYNC=false
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
ports:
- 8080:8080
<<: &default_logging
Expand All @@ -26,6 +28,7 @@ services:
restart: unless-stopped
depends_on:
- postgresql
- redis

postgresql:
image: postgres:16
Expand All @@ -41,5 +44,17 @@ services:
<<: *default_logging
restart: unless-stopped

redis:
image: redis:7
container_name: redis
command: "redis-server --loglevel warning"
volumes:
- redis_data:/data/
ports:
- "6379:6379"
<<: *default_logging
restart: unless-stopped

volumes:
postgres_data:
redis_data:
197 changes: 197 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
"migration:generate": "npm run typeorm migration:generate src/migrations/$npm_config_name",
"migration:run": "npm run typeorm migration:run",
"migration:revert": "npm run typeorm migration:revert",
"prepare": "husky install"
"prepare": "husky install",
"seed": "ts-node -r tsconfig-paths/register src/scripts/seed.ts"
},
"dependencies": {
"@casl/ability": "^6.7.1",
"@nestjs/cache-manager": "^2.2.2",
"@nestjs/common": "^10.3.8",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.3.8",
Expand All @@ -32,6 +35,7 @@
"@nestjs/swagger": "^7.3.1",
"@nestjs/typeorm": "^10.0.2",
"bcrypt": "^5.1.1",
"cache-manager-redis-yet": "^5.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dotenv": "^16.4.5",
Expand All @@ -40,6 +44,7 @@
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pg": "^8.11.5",
"redis": "^4.6.14",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"source-map-support": "^0.5.21",
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const APP_PORT = 8080;
export const TOTAL_COUNT_HEADER_KEY = 'X-Total-Count';
export const CACHE_PREFIX_USER = 'user:';
Loading

0 comments on commit 5a515c9

Please sign in to comment.