fix: harden tenant auth and quality gates
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Post, Query, UsePipes } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { TenantId } from '../common/tenant-id.decorator';
|
||||
import { CurrentTenantId } from '../auth/current-tenant-id.decorator';
|
||||
import { ClientBillingEstimateDto } from '../common/client-write.dto';
|
||||
import { strictValidationPipe } from '../common/strict-validation.pipe';
|
||||
import { RequireRecentAuthentication } from '../auth/require-recent-authentication.decorator';
|
||||
import { CurrentSessionUserId } from '../auth/current-session-user.decorator';
|
||||
import {
|
||||
@@ -125,14 +128,15 @@ export class ClientBillingController {
|
||||
constructor(private readonly billing: BillingService) {}
|
||||
|
||||
@Get('orders')
|
||||
listRechargeOrders(@TenantId() tenantId?: string, @Query('page') page?: string, @Query('pageSize') pageSize?: string) {
|
||||
listRechargeOrders(@CurrentTenantId() tenantId: string, @Query('page') page?: string, @Query('pageSize') pageSize?: string) {
|
||||
return page || pageSize
|
||||
? this.billing.listRechargeOrdersPage({ tenantId, page: Number(page), pageSize: Number(pageSize) })
|
||||
: this.billing.listRechargeOrders(tenantId);
|
||||
}
|
||||
|
||||
@Post('estimate')
|
||||
estimateSmsCost(@Body() body: EstimateSmsCostDto) {
|
||||
return this.billing.estimateSmsCost(body);
|
||||
@UsePipes(strictValidationPipe)
|
||||
estimateSmsCost(@CurrentTenantId() tenantId: string, @Body() body: ClientBillingEstimateDto) {
|
||||
return this.billing.estimateSmsCost({ ...body, tenantId });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user