25 lines
831 B
TypeScript
25 lines
831 B
TypeScript
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
|
|
import { BotService } from './bot.service';
|
|
import { CurrentTenantContext } from '../auth/current-tenant.decorator';
|
|
import { TenantContext } from '../../common/tenant-context';
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
import { RolesGuard } from '../auth/roles.guard';
|
|
import { Roles } from '../auth/roles.decorator';
|
|
|
|
@Controller('admin/bot')
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles('OWNER', 'ADMIN')
|
|
export class BotController {
|
|
constructor(private readonly service: BotService) {}
|
|
|
|
@Get()
|
|
get(@CurrentTenantContext() ctx: TenantContext) {
|
|
return this.service.get(ctx.tenantId);
|
|
}
|
|
|
|
@Post('reveal')
|
|
reveal(@CurrentTenantContext() ctx: TenantContext) {
|
|
return this.service.reveal(ctx.tenantId, ctx.adminId ?? '');
|
|
}
|
|
}
|