Format
This commit is contained in:
parent
bec21ff3e0
commit
a0dd7dd174
46 changed files with 138 additions and 139 deletions
|
@ -173,6 +173,7 @@ sub startup {
|
||||||
$api_public->post('/register')->to('api-register#post_register');
|
$api_public->post('/register')->to('api-register#post_register');
|
||||||
$api_public->post('/logout')->to('api-auth#post_logout');
|
$api_public->post('/logout')->to('api-auth#post_logout');
|
||||||
$api_public->post('/feedback')->to('api-feedback#post_feedback');
|
$api_public->post('/feedback')->to('api-feedback#post_feedback');
|
||||||
|
|
||||||
$api_public->post('/check-device-token')->to('api-devices#check_token');
|
$api_public->post('/check-device-token')->to('api-devices#check_token');
|
||||||
$api_public->post('/add-device-token')->to('api-devices#add_token');
|
$api_public->post('/add-device-token')->to('api-devices#add_token');
|
||||||
$api_public->post('/get-topics')->to('api-sendmessage#get_topics');
|
$api_public->post('/get-topics')->to('api-sendmessage#get_topics');
|
||||||
|
@ -282,8 +283,7 @@ sub startup {
|
||||||
$admin_routes->post('/categories')->to('admin-categories#create');
|
$admin_routes->post('/categories')->to('admin-categories#create');
|
||||||
$admin_routes->get('/categories/:id')->to('admin-categories#get');
|
$admin_routes->get('/categories/:id')->to('admin-categories#get');
|
||||||
$admin_routes->post('/categories/:id')->to('admin-categories#update');
|
$admin_routes->post('/categories/:id')->to('admin-categories#update');
|
||||||
$admin_routes->post('/categories/:id/delete')
|
$admin_routes->post('/categories/:id/delete')->to('admin-categories#del');
|
||||||
->to('admin-categories#del');
|
|
||||||
|
|
||||||
$admin_routes->get('/users')->to('admin-users#index');
|
$admin_routes->get('/users')->to('admin-users#index');
|
||||||
$admin_routes->get('/users/:id')->to('admin-users#read');
|
$admin_routes->get('/users/:id')->to('admin-users#read');
|
||||||
|
|
|
@ -127,9 +127,8 @@ sub org_search {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
my @results = (
|
my @results =
|
||||||
map { { label => $_->name, value => $_->entity->id, } } $rs->all
|
( map { { label => $_->name, value => $_->entity->id, } } $rs->all );
|
||||||
);
|
|
||||||
|
|
||||||
$c->render( json => \@results );
|
$c->render( json => \@results );
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,8 @@ sub post_login {
|
||||||
sub post_logout {
|
sub post_logout {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
|
|
||||||
|
print STDERR "TEST";
|
||||||
|
|
||||||
my $session_key = $c->req->json('/session_key');
|
my $session_key = $c->req->json('/session_key');
|
||||||
|
|
||||||
my $session_result =
|
my $session_result =
|
||||||
|
|
|
@ -9,10 +9,6 @@ use Carp;
|
||||||
|
|
||||||
has error_messages => sub {
|
has error_messages => sub {
|
||||||
return {
|
return {
|
||||||
#devicetokens => {
|
|
||||||
# required => { message => 'Device token is required', status => 400 },
|
|
||||||
# in_resultset => { message => 'Device token not found', status => 400 },
|
|
||||||
#},
|
|
||||||
topic => {
|
topic => {
|
||||||
required => { message => 'Topic is required', status => 400 },
|
required => { message => 'Topic is required', status => 400 },
|
||||||
},
|
},
|
||||||
|
@ -27,12 +23,8 @@ has error_messages => sub {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
=begin comment
|
# Credit: Peter Scott/StackOverflow https://stackoverflow.com/a/53357961/4580273
|
||||||
Credit: Peter Scott/StackOverflow
|
# Credit: jeffez/StackOverflow https://stackoverflow.com/q/56556438/4580273
|
||||||
https://stackoverflow.com/a/53357961/4580273
|
|
||||||
Credit: jeffez/StackOverflow
|
|
||||||
https://stackoverflow.com/q/56556438/4580273
|
|
||||||
=cut
|
|
||||||
|
|
||||||
my $jwt = create_jwt_from_path_and_scopes( './localspend-47012.json',
|
my $jwt = create_jwt_from_path_and_scopes( './localspend-47012.json',
|
||||||
'email https://www.googleapis.com/auth/cloud-platform' );
|
'email https://www.googleapis.com/auth/cloud-platform' );
|
||||||
|
@ -104,7 +96,6 @@ sub post_message {
|
||||||
my $validation = $c->validation;
|
my $validation = $c->validation;
|
||||||
$validation->input( $c->stash->{api_json} );
|
$validation->input( $c->stash->{api_json} );
|
||||||
|
|
||||||
#$validation->required('devicetokens')->in_resultset('token', $c->schema->resultset('DeviceToken'));
|
|
||||||
$validation->required('topic');
|
$validation->required('topic');
|
||||||
$validation->required('sender')
|
$validation->required('sender')
|
||||||
->in_resultset( 'name', $c->schema->resultset('Organisation') );
|
->in_resultset( 'name', $c->schema->resultset('Organisation') );
|
||||||
|
|
|
@ -464,8 +464,7 @@ sub post_leaderboards {
|
||||||
@leaderboard_array = (
|
@leaderboard_array = (
|
||||||
map {
|
map {
|
||||||
{
|
{
|
||||||
%$_,
|
%$_, value => $_->{value} / 100000
|
||||||
value => $_->{value} / 100000
|
|
||||||
}
|
}
|
||||||
} @leaderboard_array
|
} @leaderboard_array
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,7 +34,8 @@ sub _row_to_result {
|
||||||
my $address = (
|
my $address = (
|
||||||
defined $addr2
|
defined $addr2
|
||||||
? ( $row->{"address line 2"} . ' ' . $addr2 )
|
? ( $row->{"address line 2"} . ' ' . $addr2 )
|
||||||
: $row->{"address line 2"} );
|
: $row->{"address line 2"}
|
||||||
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
if $self->external_result->organisations->find(
|
if $self->external_result->organisations->find(
|
||||||
|
|
|
@ -99,11 +99,15 @@ sub register {
|
||||||
if ( $number eq ".." && $last_num < $actual ) {
|
if ( $number eq ".." && $last_num < $actual ) {
|
||||||
my $offset = ceil( ( $actual - $round ) / 2 ) + 1;
|
my $offset = ceil( ( $actual - $round ) / 2 ) + 1;
|
||||||
$html .= "<li"
|
$html .= "<li"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. "><a"
|
. "><a"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. " href=\""
|
. " href=\""
|
||||||
. $self->url_with->query(
|
. $self->url_with->query(
|
||||||
[ $param => $start == 0 ? $offset + 1 : $offset ] )
|
[ $param => $start == 0 ? $offset + 1 : $offset ] )
|
||||||
|
@ -115,11 +119,15 @@ sub register {
|
||||||
my $forw = $round + $actual;
|
my $forw = $round + $actual;
|
||||||
my $offset = ceil( ( ( $back - $forw ) / 2 ) + $forw );
|
my $offset = ceil( ( ( $back - $forw ) / 2 ) + $forw );
|
||||||
$html .= "<li"
|
$html .= "<li"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. "><a"
|
. "><a"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. " href=\""
|
. " href=\""
|
||||||
. $self->url_with->query(
|
. $self->url_with->query(
|
||||||
[ $param => $start == 0 ? $offset + 1 : $offset ] )
|
[ $param => $start == 0 ? $offset + 1 : $offset ] )
|
||||||
|
@ -131,18 +139,23 @@ sub register {
|
||||||
"<li class=\"active"
|
"<li class=\"active"
|
||||||
. ( $bs4 ? " " . $bs4classes{list_class} : "" )
|
. ( $bs4 ? " " . $bs4classes{list_class} : "" )
|
||||||
. "\"><span"
|
. "\"><span"
|
||||||
. ( $bs4
|
. (
|
||||||
|
$bs4
|
||||||
? " class=\"" . $bs4classes{anchor_class} . "\""
|
? " class=\"" . $bs4classes{anchor_class} . "\""
|
||||||
: "" )
|
: ""
|
||||||
. ">$show_number</span></li>";
|
) . ">$show_number</span></li>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$html .= "<li"
|
$html .= "<li"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. "><a"
|
. "><a"
|
||||||
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
. (
|
||||||
: "" )
|
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
|
||||||
|
: ""
|
||||||
|
)
|
||||||
. " href=\""
|
. " href=\""
|
||||||
. $self->url_with->query( [ $param => $number ] )
|
. $self->url_with->query( [ $param => $number ] )
|
||||||
. $query
|
. $query
|
||||||
|
|
|
@ -8,12 +8,8 @@ use base 'DBIx::Class::ResultSet';
|
||||||
sub as_hash {
|
sub as_hash {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my %category_list = (
|
my %category_list =
|
||||||
(
|
( ( map { $_->id => $_->name, } $self->all ), 0 => 'Uncategorised', );
|
||||||
map { $_->id => $_->name, } $self->all
|
|
||||||
),
|
|
||||||
0 => 'Uncategorised',
|
|
||||||
);
|
|
||||||
return \%category_list;
|
return \%category_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +17,7 @@ sub as_hash_name_icon {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my %category_list = (
|
my %category_list = (
|
||||||
(
|
( map { $_->name => $_->line_icon, } $self->all ),
|
||||||
map { $_->name => $_->line_icon, } $self->all
|
|
||||||
),
|
|
||||||
0 => 'Uncategorised',
|
0 => 'Uncategorised',
|
||||||
);
|
);
|
||||||
return \%category_list;
|
return \%category_list;
|
||||||
|
|
Reference in a new issue