diff --git a/package.json b/package.json index dd5ac9c7..5a771dab 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "@nestjs/schematics": "10.0.2", "@nestjs/testing": "10.2.7", "@rubiin/eslint-config": "^1.8.23", - "@rubiin/tsconfig": "^1.1.0", + "@rubiin/tsconfig": "^1.1.2", "@sentry/types": "^7.73.0", "@side/jest-runtime": "^1.1.0", "@swc/core": "^1.3.92", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db8a8606..ea019033 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -284,8 +284,8 @@ devDependencies: specifier: ^1.8.23 version: 1.8.23(eslint@8.51.0)(typescript@5.2.2)(vitest@0.34.6) '@rubiin/tsconfig': - specifier: ^1.1.0 - version: 1.1.0 + specifier: ^1.1.2 + version: 1.1.2 '@sentry/types': specifier: ^7.73.0 version: 7.73.0 @@ -3671,8 +3671,8 @@ packages: - vitest dev: true - /@rubiin/tsconfig@1.1.0: - resolution: {integrity: sha512-uCudO9VLzBTGJfrEALpeBuZS2DJKWnfHkOrrI6sZmXsibH+Y8SEbNBl7v/WCqslkzrTXVCXUkXAlxaCfo8tQCw==} + /@rubiin/tsconfig@1.1.2: + resolution: {integrity: sha512-xf3+G6sdAKO4Ce1NiTeqgqqSF9XVwlBa5x38RE+lV5DPcRk8gEcKCe7RWkyYein+Cvd+FcBGz8DmMA0rzJPLQw==} engines: {node: '>=18'} dev: true diff --git a/src/app.module.ts b/src/app.module.ts index 3ea5d6ea..8dfdc598 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,6 +9,12 @@ import { ClearCacheMiddleware, RealIpMiddleware } from "@common/middlewares"; import { NestCacheModule } from "@lib/cache"; import { SharedModule } from "@modules/shared/shared.module"; import { AppController } from "app.controller"; +import { SWAGGER_API_ENDPOINT } from "@common/constant"; + + +const stripeWebhookPath = "stripe/webhook"; +const excludedPaths = [stripeWebhookPath, SWAGGER_API_ENDPOINT]; + @Module({ controllers: [AppController], @@ -35,14 +41,16 @@ import { AppController } from "app.controller"; export class AppModule implements NestModule { configure(consumer: MiddlewareConsumer) { applyRawBodyOnlyTo(consumer, { + path: stripeWebhookPath, method: RequestMethod.ALL, - path: "stripe/webhook", }); consumer .apply(RealIpMiddleware, ClearCacheMiddleware) .exclude( - { path: "stripe/webhook", method: RequestMethod.ALL }, - { path: "doc", method: RequestMethod.ALL }, + ...excludedPaths.map((path) => ({ + path, + method: RequestMethod.ALL, + })), ) .forRoutes({ path: "*",