diff options
Diffstat (limited to 'lib/Travelynx/Controller/Api.pm')
-rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 4546292..b951af4 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -185,6 +185,47 @@ sub travel_v1 { return; } + if ( + @{ + [ + Travel::Status::DE::IRIS::Stations::get_station( + $from_station) + ] + } != 1 + ) + { + $self->render( + json => { + success => \0, + deprecated => \0, + error => 'fromStation is ambiguous', + status => $self->get_user_status_json_v1($uid) + }, + ); + return; + } + + if ( + $to_station + and @{ + [ + Travel::Status::DE::IRIS::Stations::get_station( + $to_station) + ] + } != 1 + ) + { + $self->render( + json => { + success => \0, + deprecated => \0, + error => 'toStation is ambiguous', + status => $self->get_user_status_json_v1($uid) + }, + ); + return; + } + if ( exists $payload->{train}{id} ) { $train_id = sanitize( 0, $payload->{train}{id} ); } |