fix(api): add JWT scheme to @ApiBearerAuth and fix Prisma 7 extensions config

- Add 'JWT' scheme name to @ApiBearerAuth() in payments & subscriptions
  controllers so Swagger UI correctly links to the JWT security definition
- Add postgresqlExtensions preview feature to Prisma schema for v7 compat

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 13:08:03 +07:00
parent 0c227b6b01
commit 91b76d567b
3 changed files with 10 additions and 11 deletions

View File

@@ -45,7 +45,7 @@ export class PaymentsController {
private readonly queryBus: QueryBus,
) {}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Create a new payment' })
@ApiResponse({ status: 201, description: 'Payment created successfully' })
@ApiResponse({ status: 400, description: 'Bad request' })
@@ -90,7 +90,7 @@ export class PaymentsController {
);
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Get payment status by ID' })
@ApiResponse({ status: 200, description: 'Payment status retrieved' })
@ApiResponse({ status: 401, description: 'Unauthorized' })
@@ -104,7 +104,7 @@ export class PaymentsController {
return this.queryBus.execute(new GetPaymentStatusQuery(id, user.sub));
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'List transactions for the authenticated user' })
@ApiResponse({ status: 200, description: 'Transactions retrieved' })
@ApiResponse({ status: 401, description: 'Unauthorized' })
@@ -119,7 +119,7 @@ export class PaymentsController {
);
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Refund a payment (admin only)' })
@ApiResponse({ status: 201, description: 'Refund initiated successfully' })
@ApiResponse({ status: 401, description: 'Unauthorized' })

View File

@@ -69,7 +69,7 @@ export class SubscriptionsController {
// ── Subscriptions (Authenticated) ──
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Create a new subscription' })
@ApiResponse({ status: 201, description: 'Subscription created' })
@ApiResponse({ status: 400, description: 'Bad request' })
@@ -85,7 +85,7 @@ export class SubscriptionsController {
);
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Upgrade an existing subscription' })
@ApiResponse({ status: 200, description: 'Subscription upgraded' })
@ApiResponse({ status: 401, description: 'Unauthorized' })
@@ -100,7 +100,7 @@ export class SubscriptionsController {
);
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Cancel an active subscription' })
@ApiResponse({ status: 200, description: 'Subscription cancelled' })
@ApiResponse({ status: 401, description: 'Unauthorized' })
@@ -117,7 +117,7 @@ export class SubscriptionsController {
// ── Usage / Quota ──
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Record metered usage' })
@ApiResponse({ status: 201, description: 'Usage recorded' })
@ApiResponse({ status: 401, description: 'Unauthorized' })
@@ -132,7 +132,7 @@ export class SubscriptionsController {
);
}
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Check remaining quota for a metric' })
@ApiParam({ name: 'metric', description: 'Usage metric identifier' })
@ApiResponse({ status: 200, description: 'Quota check result' })
@@ -148,7 +148,7 @@ export class SubscriptionsController {
// ── Billing ──
@ApiBearerAuth()
@ApiBearerAuth('JWT')
@ApiOperation({ summary: 'Get billing history' })
@ApiResponse({ status: 200, description: 'Billing history records' })
@ApiResponse({ status: 401, description: 'Unauthorized' })

View File

@@ -10,7 +10,6 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [postgis]
}