mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
52 lines
2.5 KiB
TypeScript
52 lines
2.5 KiB
TypeScript
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam, ApiResponse, ApiBody } from '@nestjs/swagger';
|
|
import { IsPublic } from '@tria-plc/api-common/modules/auth/decorators/public.decorator';
|
|
import { SeatClassesService } from './seat-classes.service';
|
|
import { CreateSeatClassDto, UpdateSeatClassDto } from './seat-classes.dto';
|
|
import { JwtGuard } from '../../common/jwt.guard';
|
|
|
|
@ApiTags('Seat Classes')
|
|
@Controller('seat-classes')
|
|
export class SeatClassesController {
|
|
constructor(private service: SeatClassesService) {}
|
|
|
|
@Get()
|
|
@IsPublic()
|
|
@ApiOperation({ summary: 'List all seat classes' })
|
|
@ApiResponse({ status: 200, description: 'Returns all seat classes with their coaches' })
|
|
listSeatClasses() { return this.service.listSeatClasses(); }
|
|
|
|
@Get(':id')
|
|
@IsPublic()
|
|
@ApiOperation({ summary: 'Get a seat class by ID' })
|
|
@ApiParam({ name: 'id', description: 'Seat class UUID' })
|
|
@ApiResponse({ status: 200, description: 'Returns seat class with its coaches' })
|
|
@ApiResponse({ status: 404, description: 'Seat class not found' })
|
|
getSeatClass(@Param('id') id: string) { return this.service.getSeatClass(id); }
|
|
|
|
@Post()
|
|
@UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth')
|
|
@ApiOperation({ summary: 'Create a seat class' })
|
|
@ApiBody({ type: CreateSeatClassDto })
|
|
@ApiResponse({ status: 201, description: 'Seat class created' })
|
|
@ApiResponse({ status: 409, description: 'Seat class name already exists' })
|
|
createSeatClass(@Body() dto: CreateSeatClassDto) { return this.service.createSeatClass(dto); }
|
|
|
|
@Patch(':id')
|
|
@UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth')
|
|
@ApiOperation({ summary: 'Update a seat class' })
|
|
@ApiParam({ name: 'id', description: 'Seat class UUID' })
|
|
@ApiBody({ type: UpdateSeatClassDto })
|
|
@ApiResponse({ status: 200, description: 'Seat class updated' })
|
|
@ApiResponse({ status: 404, description: 'Seat class not found' })
|
|
updateSeatClass(@Param('id') id: string, @Body() dto: UpdateSeatClassDto) { return this.service.updateSeatClass(id, dto); }
|
|
|
|
@Delete(':id')
|
|
@UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth')
|
|
@ApiOperation({ summary: 'Delete a seat class' })
|
|
@ApiParam({ name: 'id', description: 'Seat class UUID' })
|
|
@ApiResponse({ status: 200, description: 'Seat class deleted' })
|
|
@ApiResponse({ status: 404, description: 'Seat class not found' })
|
|
deleteSeatClass(@Param('id') id: string) { return this.service.deleteSeatClass(id); }
|
|
}
|