initial: standalone repo from monorepo split
This commit is contained in:
25
src/billing/billing.controller.ts
Normal file
25
src/billing/billing.controller.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Controller, Get, Patch, Body, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { BillingService } from './billing.service';
|
||||
import { UpdateBillingSettingsDto } from './dto/update-billing-settings.dto';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { TenantGuard } from '../common/guards/tenant.guard';
|
||||
import { CurrentUser, CurrentUserPayload } from '../common/decorators/current-user.decorator';
|
||||
|
||||
@Controller('billing-settings')
|
||||
@UseGuards(AuthGuard('jwt'), TenantGuard, RolesGuard)
|
||||
@Roles('tenant_admin')
|
||||
export class BillingController {
|
||||
constructor(private readonly billingService: BillingService) {}
|
||||
|
||||
@Get()
|
||||
async getSettings(@CurrentUser() user: CurrentUserPayload) {
|
||||
return this.billingService.getSettings(user.tenantId);
|
||||
}
|
||||
|
||||
@Patch()
|
||||
async updateSettings(@CurrentUser() user: CurrentUserPayload, @Body() dto: UpdateBillingSettingsDto) {
|
||||
return this.billingService.updateSettings(user.tenantId, dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user