From f89808826026c1f0e63f3a77afc802967a46bae4 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 16 Oct 2024 03:45:59 +0200 Subject: api/v1/import: hard-code backend_id to 1 (same as import form) Closes #162 See also #170 (thanks to https://github.com/homologic for the suggestion) --- lib/Travelynx/Controller/Api.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 5fbfb3e..0cc2c18 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -206,7 +206,9 @@ sub travel_v1 { return; } - if ( not $hafas and not $self->stations->search($from_station, iris => 1) ) { + if ( not $hafas + and not $self->stations->search( $from_station, backend_id => 1 ) ) + { $self->render( json => { success => \0, @@ -221,7 +223,7 @@ sub travel_v1 { if ( $to_station and not $hafas - and not $self->stations->search($to_station, iris => 1) ) + and not $self->stations->search( $to_station, backend_id => 1 ) ) { $self->render( json => { @@ -528,8 +530,9 @@ sub import_v1 { $payload->{toStation}{realTime} // $payload->{toStation}{scheduledTime} ), - comment => sanitize( q{}, $payload->{comment} ), - lax => $payload->{lax} ? 1 : 0, + comment => sanitize( q{}, $payload->{comment} ), + lax => $payload->{lax} ? 1 : 0, + backend_id => 1, ); if ( $payload->{intermediateStops} -- cgit v1.2.3