| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import {
- Body,
- Controller,
- Delete,
- ForbiddenException,
- Get,
- Param,
- Post,
- Put,
- Request,
- UseGuards,
- } from '@nestjs/common';
- import { TenantService } from './tenant.service';
- import { CombinedAuthGuard } from '../auth/combined-auth.guard';
- import { SuperAdminGuard } from '../auth/super-admin.guard';
- @Controller('tenants')
- @UseGuards(CombinedAuthGuard, SuperAdminGuard)
- export class TenantController {
- constructor(private readonly tenantService: TenantService) { }
- @Get()
- findAll() {
- return this.tenantService.findAll();
- }
- @Get(':id')
- findOne(@Param('id') id: string) {
- return this.tenantService.findById(id);
- }
- @Post()
- create(@Body() body: { name: string; description?: string }) {
- return this.tenantService.create(body.name, body.description);
- }
- @Put(':id')
- update(@Param('id') id: string, @Body() body: { name?: string; description?: string; isActive?: boolean }) {
- return this.tenantService.update(id, body);
- }
- @Delete(':id')
- remove(@Param('id') id: string) {
- return this.tenantService.remove(id);
- }
- @Get(':id/settings')
- getSettings(@Param('id') id: string) {
- return this.tenantService.getSettings(id);
- }
- @Put(':id/settings')
- updateSettings(@Param('id') id: string, @Body() body: any) {
- return this.tenantService.updateSettings(id, body);
- }
- }
|