api: use int on defined pager methods
This commit is contained in:
parent
45a4b69ca3
commit
46682ed7da
@ -4,9 +4,11 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Mojo::Base "Mojolicious";
|
use Mojo::Base "Mojolicious";
|
||||||
|
|
||||||
use PoorBooru::Schema;
|
use PoorBooru::Schema;
|
||||||
|
|
||||||
|
my @PAGER_METHODS = qw(first_page previous_page current_page next_page
|
||||||
|
last_page);
|
||||||
|
|
||||||
sub startup ($self)
|
sub startup ($self)
|
||||||
{
|
{
|
||||||
$self->moniker("poorbooru-api-v0");
|
$self->moniker("poorbooru-api-v0");
|
||||||
@ -18,8 +20,7 @@ sub startup ($self)
|
|||||||
state $schema = PoorBooru::Schema->connect($config->{dsn})
|
state $schema = PoorBooru::Schema->connect($config->{dsn})
|
||||||
});
|
});
|
||||||
$self->helper(pager => sub ($, $dbp) {
|
$self->helper(pager => sub ($, $dbp) {
|
||||||
map +( $_ => $dbp->$_ ), qw(first_page previous_page
|
map +( $_ => ($dbp->$_ and int($dbp->$_)) ), @PAGER_METHODS;
|
||||||
current_page next_page last_page)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
my $r = $self->routes;
|
my $r = $self->routes;
|
||||||
|
Loading…
Reference in New Issue
Block a user