mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 18:20:57 +00:00
Updated seat class and coach mangement
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam, ApiResponse, ApiBody } from '@nestjs/swagger';
|
||||
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()
|
||||
@ApiOperation({ summary: 'List all seat classes' })
|
||||
@ApiResponse({ status: 200, description: 'Returns all seat classes with their coaches' })
|
||||
listSeatClasses() { return this.service.listSeatClasses(); }
|
||||
|
||||
@Get(':id')
|
||||
@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); }
|
||||
}
|
||||
Reference in New Issue
Block a user