mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 13:28:11 +00:00
Refactor business logic for train,schedule,coach,seat and search modules
This commit is contained in:
@@ -10,12 +10,12 @@ export class SeatsController {
|
||||
constructor(private service: SeatsService) {}
|
||||
|
||||
// ── Seat Map ──────────────────────────────────────────────────────────────
|
||||
@Get('seatmap/:tripId')
|
||||
@ApiOperation({ summary: 'Get seat map for a trip' })
|
||||
@ApiParam({ name: 'tripId', description: 'Trip UUID' })
|
||||
@Get('seatmap/:scheduleId')
|
||||
@ApiOperation({ summary: 'Get seat map for a schedule' })
|
||||
@ApiParam({ name: 'scheduleId', description: 'TrainSchedule UUID' })
|
||||
@ApiQuery({ name: 'coachId', required: false, description: 'Filter by coach UUID' })
|
||||
@ApiResponse({ status: 200, description: 'Returns coaches with seats and seat class info' })
|
||||
getSeatMap(@Param('tripId') tripId: string, @Query('coachId') coachId?: string) { return this.service.getSeatMap(tripId, coachId); }
|
||||
getSeatMap(@Param('scheduleId') scheduleId: string, @Query('coachId') coachId?: string) { return this.service.getSeatMap(scheduleId, coachId); }
|
||||
|
||||
// ── Hold / Release ────────────────────────────────────────────────────────
|
||||
@Post('hold')
|
||||
@@ -33,10 +33,10 @@ export class SeatsController {
|
||||
@ApiResponse({ status: 404, description: 'Hold not found' })
|
||||
releaseHold(@Param('holdId') holdId: string) { return this.service.releaseHold(holdId); }
|
||||
|
||||
@Get('export/csv/:tripId') @UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth') @ApiOperation({ summary: 'Export seats as CSV' })
|
||||
async exportCSV(@Param('tripId') tripId: string) {
|
||||
const csv = await this.service.exportSeatsCSV(tripId);
|
||||
return { csv, filename: `seats-${tripId}.csv` };
|
||||
@Get('export/csv/:scheduleId') @UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth') @ApiOperation({ summary: 'Export seats as CSV' })
|
||||
async exportCSV(@Param('scheduleId') scheduleId: string) {
|
||||
const csv = await this.service.exportSeatsCSV(scheduleId);
|
||||
return { csv, filename: `seats-${scheduleId}.csv` };
|
||||
}
|
||||
|
||||
@Post('import/preview') @UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth') @ApiOperation({ summary: 'Preview CSV import' })
|
||||
@@ -45,7 +45,7 @@ export class SeatsController {
|
||||
}
|
||||
|
||||
@Post('import/commit') @UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth') @ApiOperation({ summary: 'Commit CSV import' })
|
||||
importCSV(@Body() body: { tripId: string; csv: string; commit: boolean }) {
|
||||
return this.service.importSeatsCSV(body.tripId, body.csv, body.commit);
|
||||
importCSV(@Body() body: { scheduleId: string; csv: string; commit: boolean }) {
|
||||
return this.service.importSeatsCSV(body.scheduleId, body.csv, body.commit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user