mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
Round trip journeys, feedback items, backoffice documentation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Body, Controller, Get, Param, Post, Patch, Delete, UseGuards, Query } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiQuery } from '@nestjs/swagger';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiQuery, ApiResponse } from '@nestjs/swagger';
|
||||
import { StationsService } from './stations.service';
|
||||
import { CreateStationDto } from './stations.dto';
|
||||
import { JwtGuard } from '../../common/jwt.guard';
|
||||
@@ -17,6 +17,28 @@ export class StationsController {
|
||||
@ApiQuery({ name: 'search', required: false, description: 'Search by station name or code' })
|
||||
@ApiQuery({ name: 'country', required: false, description: 'Filter by country code (ET, DJ)' })
|
||||
@ApiQuery({ name: 'operational', required: false, description: 'Filter by operational status (true, false)' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Array of stations',
|
||||
schema: {
|
||||
example: [
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
code: 'AAA',
|
||||
sequence: 1,
|
||||
name: 'Addis Ababa',
|
||||
city: 'Addis Ababa',
|
||||
countryCode: 'ET',
|
||||
lat: 9.0054,
|
||||
lng: 38.7636,
|
||||
timezone: 'Africa/Addis_Ababa',
|
||||
isOperational: true,
|
||||
createdAt: '2024-01-15T10:30:00.000Z',
|
||||
updatedAt: '2024-01-15T10:30:00.000Z'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
findAll(
|
||||
@Query('search') search?: string,
|
||||
@Query('country') country?: string,
|
||||
@@ -30,18 +52,79 @@ export class StationsController {
|
||||
summary: 'Get station details by ID',
|
||||
description: 'Returns station information including name, code, country, coordinates, and facilities'
|
||||
})
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Station details',
|
||||
schema: {
|
||||
example: {
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
code: 'AAA',
|
||||
sequence: 1,
|
||||
name: 'Addis Ababa',
|
||||
city: 'Addis Ababa',
|
||||
countryCode: 'ET',
|
||||
lat: 9.0054,
|
||||
lng: 38.7636,
|
||||
timezone: 'Africa/Addis_Ababa',
|
||||
isOperational: true,
|
||||
createdAt: '2024-01-15T10:30:00.000Z',
|
||||
updatedAt: '2024-01-15T10:30:00.000Z'
|
||||
}
|
||||
}
|
||||
})
|
||||
findOne(@Param('id') id: string) { return this.service.findOne(id); }
|
||||
|
||||
@Post()
|
||||
@UseGuards(JwtGuard)
|
||||
@ApiBearerAuth('JWT-auth')
|
||||
@ApiOperation({ summary: 'Create new station' })
|
||||
@ApiResponse({
|
||||
status: 201,
|
||||
description: 'Station created',
|
||||
schema: {
|
||||
example: {
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
code: 'AAA',
|
||||
sequence: 1,
|
||||
name: 'Addis Ababa',
|
||||
city: 'Addis Ababa',
|
||||
countryCode: 'ET',
|
||||
lat: 9.0054,
|
||||
lng: 38.7636,
|
||||
timezone: 'Africa/Addis_Ababa',
|
||||
isOperational: true,
|
||||
createdAt: '2024-01-15T10:30:00.000Z',
|
||||
updatedAt: '2024-01-15T10:30:00.000Z'
|
||||
}
|
||||
}
|
||||
})
|
||||
create(@Body() dto: CreateStationDto) { return this.service.create(dto); }
|
||||
|
||||
@Patch(':id')
|
||||
@UseGuards(JwtGuard)
|
||||
@ApiBearerAuth('JWT-auth')
|
||||
@ApiOperation({ summary: 'Update station' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Station updated',
|
||||
schema: {
|
||||
example: {
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
code: 'AAA',
|
||||
sequence: 1,
|
||||
name: 'Addis Ababa',
|
||||
city: 'Addis Ababa',
|
||||
countryCode: 'ET',
|
||||
lat: 9.0054,
|
||||
lng: 38.7636,
|
||||
timezone: 'Africa/Addis_Ababa',
|
||||
isOperational: true,
|
||||
createdAt: '2024-01-15T10:30:00.000Z',
|
||||
updatedAt: '2024-01-15T10:30:00.000Z'
|
||||
}
|
||||
}
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'Station not found' })
|
||||
update(@Param('id') id: string, @Body() dto: Partial<CreateStationDto>) {
|
||||
return this.service.update(id, dto);
|
||||
}
|
||||
@@ -50,6 +133,8 @@ export class StationsController {
|
||||
@UseGuards(JwtGuard)
|
||||
@ApiBearerAuth('JWT-auth')
|
||||
@ApiOperation({ summary: 'Delete station' })
|
||||
@ApiResponse({ status: 200, description: 'Station deleted successfully' })
|
||||
@ApiResponse({ status: 404, description: 'Station not found' })
|
||||
remove(@Param('id') id: string) {
|
||||
return this.service.remove(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user