Skip to content

Commit

Permalink
api/v1/import: hard-code backend_id to 1 (same as import form)
Browse files Browse the repository at this point in the history
Closes #162
See also #170 (thanks to https://github.com/homologic for the suggestion)
  • Loading branch information
derf committed Oct 16, 2024
1 parent 325b6e2 commit f898088
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Travelynx/Controller/Api.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 => {
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit f898088

Please sign in to comment.