From 2f9ba6e0177dbf641c459a7d89528ed561bff6f8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 7 Dec 2022 19:42:48 +0100 Subject: switch to internal station database; add out-of-service stations for old journeys --- lib/Travelynx/Controller/Api.pm | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'lib/Travelynx/Controller/Api.pm') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 3e9c5eb..f686222 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -7,7 +7,6 @@ use Mojo::Base 'Mojolicious::Controller'; use DateTime; use List::Util; -use Travel::Status::DE::IRIS::Stations; use UUID::Tiny qw(:std); # Internal Helpers @@ -184,41 +183,24 @@ sub travel_v1 { return; } - if ( - @{ - [ - Travel::Status::DE::IRIS::Stations::get_station( - $from_station) - ] - } != 1 - ) - { + if ( not $self->stations->search($from_station) ) { $self->render( json => { success => \0, deprecated => \0, - error => 'fromStation is ambiguous', + error => 'Unknown fromStation', status => $self->get_user_status_json_v1($uid) }, ); return; } - if ( - $to_station - and @{ - [ - Travel::Status::DE::IRIS::Stations::get_station( - $to_station) - ] - } != 1 - ) - { + if ( $to_station and not $self->stations->search($to_station) ) { $self->render( json => { success => \0, deprecated => \0, - error => 'toStation is ambiguous', + error => 'Unknown toStation', status => $self->get_user_status_json_v1($uid) }, ); -- cgit v1.2.3