From 47b957361e84c826bfee0fa4e45db9de9e5c0182 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 16 Aug 2020 21:20:23 +0200 Subject: Move most journey code to newly introduced Journey model --- lib/Travelynx/Controller/Api.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Travelynx/Controller/Api.pm') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 8af57be..6ffd310 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -492,18 +492,18 @@ sub import_v1 { my $tx = $db->begin; $opt{db} = $db; - my ( $journey_id, $error ) = $self->add_journey(%opt); + my ( $journey_id, $error ) = $self->journeys->add(%opt); my $journey; if ( not $error ) { - $journey = $self->get_journey( + $journey = $self->journeys->get_single( uid => $uid, db => $db, journey_id => $journey_id, verbose => 1 ); $error - = $self->journey_sanity_check( $journey, $payload->{lax} ? 1 : 0 ); + = $self->journeys->sanity_check( $journey, $payload->{lax} ? 1 : 0 ); } if ($error) { @@ -526,7 +526,11 @@ sub import_v1 { ); } else { - $self->invalidate_stats_cache( $opt{rt_departure}, $db, $uid ); + $self->journeys->invalidate_stats_cache( + ts => $opt{rt_departure}, + db => $db, + uid => $uid + ); $tx->commit; $self->render( json => { -- cgit v1.2.3