From 5f8100c0c5dbcdcc1ec40b2eda57f1455862ef63 Mon Sep 17 00:00:00 2001 From: YakovchukIvan <81960402+YakovchukIvan@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:15:04 +0300 Subject: [PATCH] feat: update docker-compose for app service and improve token handling in auth module --- docker-compose.yml | 43 +++++++++++++++++++ .../interfaces/token-payload.interface.ts | 2 +- src/modules/auth/services/token.service.ts | 5 ++- tsconfig.json | 3 +- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a73a0fc..e30a91b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,6 +39,49 @@ services: redis: condition: service_healthy + app: + build: + context: . + dockerfile: Dockerfile + target: development + container_name: backend-developer + restart: always + ports: + - '${APP_PORT}:5000' + env_file: + - .env.development + environment: + POSTGRES_HOST: postgres + REDIS_HOST: redis + volumes: + - ./:/app + - app_node_modules:/app/node_modules + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + command: npm run start:dev + develop: + watch: + - action: sync + path: . + target: /app + ignore: + - node_modules/ + - dist/ + - coverage/ + - .git/ + - .idea/ + - .vscode/ + - .env + - .env.* + - action: rebuild + path: package.json + - action: rebuild + path: package-lock.json + volumes: postgres_data: + app_node_modules: redis_data: diff --git a/src/modules/auth/interfaces/token-payload.interface.ts b/src/modules/auth/interfaces/token-payload.interface.ts index 41863ad..c34c6a3 100644 --- a/src/modules/auth/interfaces/token-payload.interface.ts +++ b/src/modules/auth/interfaces/token-payload.interface.ts @@ -1,7 +1,7 @@ import { JwtPayload } from '@/common/interfaces/jwt-payload.interface'; export interface AccessTokenPayload extends JwtPayload { - jti: string; + jti?: string; } export interface RefreshTokenPayload { diff --git a/src/modules/auth/services/token.service.ts b/src/modules/auth/services/token.service.ts index f46da23..26e70e9 100644 --- a/src/modules/auth/services/token.service.ts +++ b/src/modules/auth/services/token.service.ts @@ -24,7 +24,10 @@ export class TokenService { return payload; } - async assertAccessTokenNotRevoked(userId: string, jti: string): Promise { + async assertAccessTokenNotRevoked(userId: string, jti: string | undefined): Promise { + if (!jti) { + return; + } const isValid = await this.tokenRedisRepository.isAccessTokenValid(userId, jti); if (!isValid) { throw new UnauthorizedException('Token has been revoked'); diff --git a/tsconfig.json b/tsconfig.json index 5218f4c..dafec0a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,9 +13,8 @@ "target": "ES2023", "sourceMap": true, "outDir": "./dist", - "baseUrl": "./", "paths": { - "@/*": ["src/*"] + "@/*": ["./src/*"] }, "incremental": true, "skipLibCheck": true,