Files
canina/backend/src/support-chat/support-chat-settings.controller.ts
T

18 lines
1.0 KiB
TypeScript

import { Body, Controller, Get, Put, UseGuards, Header } from '@nestjs/common';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { RolesGuard } from '../common/guards/roles.guard';
import { Roles } from '../common/decorators/roles.decorator';
import { SupportChatSettingsService } from './support-chat-settings.service';
@Controller('support-chat')
export class SupportChatSettingsController {
constructor(private readonly settings: SupportChatSettingsService) {}
@Get('config') @Header('Cache-Control', 'no-store')
config() { return this.settings.publicConfig(); }
@Get('settings') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('Admin') @Header('Cache-Control', 'no-store')
read() { return this.settings.read(); }
@Get('catalog') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('Admin') @Header('Cache-Control', 'no-store')
catalog() { return this.settings.catalog(); }
@Put('settings') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('Admin')
save(@Body() body: unknown) { return this.settings.save(body); }
}