This commit is contained in:
Rumperuu 2021-03-20 23:26:52 +00:00
parent bec21ff3e0
commit a0dd7dd174
46 changed files with 138 additions and 139 deletions

View file

@ -173,6 +173,7 @@ sub startup {
$api_public->post('/register')->to('api-register#post_register');
$api_public->post('/logout')->to('api-auth#post_logout');
$api_public->post('/feedback')->to('api-feedback#post_feedback');
$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('/get-topics')->to('api-sendmessage#get_topics');
@ -282,8 +283,7 @@ sub startup {
$admin_routes->post('/categories')->to('admin-categories#create');
$admin_routes->get('/categories/:id')->to('admin-categories#get');
$admin_routes->post('/categories/:id')->to('admin-categories#update');
$admin_routes->post('/categories/:id/delete')
->to('admin-categories#del');
$admin_routes->post('/categories/:id/delete')->to('admin-categories#del');
$admin_routes->get('/users')->to('admin-users#index');
$admin_routes->get('/users/:id')->to('admin-users#read');

View file

@ -71,7 +71,7 @@ sub post_add {
}
);
## no critic (InputOutput::RequireBriefOpen)
## no critic (InputOutput::RequireBriefOpen)
open my $fh, '<', \$csv_data;
# List context returns the actual headers

View file

@ -127,9 +127,8 @@ sub org_search {
},
);
my @results = (
map { { label => $_->name, value => $_->entity->id, } } $rs->all
);
my @results =
( map { { label => $_->name, value => $_->entity->id, } } $rs->all );
$c->render( json => \@results );

View file

@ -123,7 +123,7 @@ sub valid_read {
}
sub valid_edit {
my ($c, $warning) = @_;
my ( $c, $warning ) = @_;
my $validation = $c->validation;
$validation->required('name');

View file

@ -70,7 +70,7 @@ sub read {
## no critic (Subroutines::ProhibitBuiltinHomonyms)
sub update {
## use critic
my ($c, $error) = @_;
my ( $c, $error ) = @_;
my $id = $c->param('id');

View file

@ -124,6 +124,8 @@ sub post_login {
sub post_logout {
my $c = shift;
print STDERR "TEST";
my $session_key = $c->req->json('/session_key');
my $session_result =

View file

@ -9,10 +9,6 @@ use Carp;
has error_messages => sub {
return {
#devicetokens => {
# required => { message => 'Device token is required', status => 400 },
# in_resultset => { message => 'Device token not found', status => 400 },
#},
topic => {
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: jeffez/StackOverflow
https://stackoverflow.com/q/56556438/4580273
=cut
# Credit: Peter Scott/StackOverflow https://stackoverflow.com/a/53357961/4580273
# Credit: jeffez/StackOverflow https://stackoverflow.com/q/56556438/4580273
my $jwt = create_jwt_from_path_and_scopes( './localspend-47012.json',
'email https://www.googleapis.com/auth/cloud-platform' );
@ -104,7 +96,6 @@ sub post_message {
my $validation = $c->validation;
$validation->input( $c->stash->{api_json} );
#$validation->required('devicetokens')->in_resultset('token', $c->schema->resultset('DeviceToken'));
$validation->required('topic');
$validation->required('sender')
->in_resultset( 'name', $c->schema->resultset('Organisation') );

View file

@ -460,12 +460,11 @@ sub post_leaderboards {
my @leaderboard_array = $today_values->all;
if ( $validation->param('type') =~ /total$/ ) {
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
@leaderboard_array = (
map {
{
%$_,
value => $_->{value} / 100000
%$_, value => $_->{value} / 100000
}
} @leaderboard_array
);
@ -545,7 +544,7 @@ sub post_leaderboards_paged {
$values_count = $today_values->pager->total_entries;
if ( $validation->param('type') =~ /total$/ ) {
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements)
@leaderboard_array = (
map {
{

View file

@ -34,7 +34,8 @@ sub _row_to_result {
my $address = (
defined $addr2
? ( $row->{"address line 2"} . ' ' . $addr2 )
: $row->{"address line 2"} );
: $row->{"address line 2"}
);
return
if $self->external_result->organisations->find(

View file

@ -99,11 +99,15 @@ sub register {
if ( $number eq ".." && $last_num < $actual ) {
my $offset = ceil( ( $actual - $round ) / 2 ) + 1;
$html .= "<li"
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: ""
)
. "><a"
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: ""
)
. " href=\""
. $self->url_with->query(
[ $param => $start == 0 ? $offset + 1 : $offset ] )
@ -115,11 +119,15 @@ sub register {
my $forw = $round + $actual;
my $offset = ceil( ( ( $back - $forw ) / 2 ) + $forw );
$html .= "<li"
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: ""
)
. "><a"
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: ""
)
. " href=\""
. $self->url_with->query(
[ $param => $start == 0 ? $offset + 1 : $offset ] )
@ -131,18 +139,23 @@ sub register {
"<li class=\"active"
. ( $bs4 ? " " . $bs4classes{list_class} : "" )
. "\"><span"
. ( $bs4
. (
$bs4
? " class=\"" . $bs4classes{anchor_class} . "\""
: "" )
. ">$show_number</span></li>";
: ""
) . ">$show_number</span></li>";
}
else {
$html .= "<li"
. ( $bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{list_class} . "\""
: ""
)
. "><a"
. ( $bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: "" )
. (
$bs4 ? " class=\"" . $bs4classes{anchor_class} . "\""
: ""
)
. " href=\""
. $self->url_with->query( [ $param => $number ] )
. $query

View file

@ -8,12 +8,8 @@ use base 'DBIx::Class::ResultSet';
sub as_hash {
my ($self) = @_;
my %category_list = (
(
map { $_->id => $_->name, } $self->all
),
0 => 'Uncategorised',
);
my %category_list =
( ( map { $_->id => $_->name, } $self->all ), 0 => 'Uncategorised', );
return \%category_list;
}
@ -21,9 +17,7 @@ sub as_hash_name_icon {
my ($self) = @_;
my %category_list = (
(
map { $_->name => $_->line_icon, } $self->all
),
( map { $_->name => $_->line_icon, } $self->all ),
0 => 'Uncategorised',
);
return \%category_list;

View file

@ -39,7 +39,7 @@ sub _unordered_get_values {
}
sub get_users {
my ($self, $set_id) = @_;
my ( $self, $set_id ) = @_;
return $self->_unordered_get_values($set_id)->search(
{},