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

@ -34,7 +34,7 @@ sub home {
pending => $pending_feedback_rs->count,
},
);
return 1;
}
@ -54,7 +54,7 @@ sub auth_login {
. "]" );
$c->redirect_to('/admin');
}
return 1;
}
@ -63,7 +63,7 @@ sub auth_logout {
$c->logout;
$c->redirect_to('/admin');
return 1;
}

View file

@ -12,7 +12,7 @@ sub idx {
my $category_rs = $c->result_set;
$category_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash( categories => [ $category_rs->all ] );
return 1;
}
@ -45,7 +45,7 @@ sub create {
$c->result_set->create( { name => $category_name } );
}
$c->redirect_to('/admin/categories');
return 1;
}
@ -62,7 +62,7 @@ sub get {
$c->flash( error => 'No Category found' );
$c->redirect_to('/admin/categories');
}
return 1;
}
@ -101,7 +101,7 @@ sub update {
$c->flash( error => 'No Category found' );
$c->redirect_to('/admin/categories');
}
return 1;
}
@ -120,7 +120,7 @@ sub del {
$c->flash( error => 'No Category found' );
}
$c->redirect_to('/admin/categories');
return 1;
}

View file

@ -18,7 +18,7 @@ sub idx {
},
);
$c->stash( feedback_rs => $feedback_rs );
return 1;
}
@ -34,7 +34,7 @@ sub get {
$c->flash( error => 'No Feedback found' );
$c->redirect_to('/admin/feedback');
}
return 1;
}
@ -52,7 +52,7 @@ sub actioned {
$c->flash( error => 'No Feedback found' );
$c->redirect_to('/admin/feedback');
}
return 1;
}

View file

@ -21,7 +21,7 @@ sub idx {
},
);
$c->stash( import_rs => $import_rs );
return 1;
}
@ -48,13 +48,13 @@ sub list {
import_org_rs => $import_org_rs,
import_lookup_rs => $import_lookup_rs,
);
return 1;
}
sub get_add {
my $c = shift;
return 1;
}
@ -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
@ -100,7 +100,7 @@ sub post_add {
}
my $csv_output = $csv->getline_hr_all($fh);
close $fh;
## use critic
@ -157,7 +157,7 @@ sub post_add {
$c->flash( success => 'Created Value Set' );
$c->redirect_to( '/admin/import/' . $value_set->id );
return 1;
}
@ -172,7 +172,7 @@ sub _csv_flash_error {
#csv_data => $c->param('csv'),
date_format => $c->param('date_format'),
);
return 1;
}
@ -223,7 +223,7 @@ sub get_user {
lookup => $lookup_result,
user_name => $user_name,
);
return 1;
}
@ -274,7 +274,7 @@ sub get_org {
lookup => $lookup_result,
org_name => $org_name,
);
return 1;
}

View file

@ -15,7 +15,7 @@ sub idx {
];
$c->app->max_request_size(104857600);
return 1;
}
@ -127,12 +127,11 @@ 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 );
return 1;
}

View file

@ -21,13 +21,13 @@ sub list {
);
$c->stash( orgs_rs => $orgs_rs, );
return 1;
}
sub add_org {
my $c = shift;
return 1;
}
@ -91,7 +91,7 @@ sub add_org_submit {
$c->redirect_to( '/admin/organisations/' . $organisation->id );
}
};
return 1;
}
@ -118,12 +118,12 @@ sub valid_read {
transactions => $transactions,
associations => $assoc,
);
return 1;
}
sub valid_edit {
my ($c, $warning) = @_;
my ( $c, $warning ) = @_;
my $validation = $c->validation;
$validation->required('name');
@ -191,7 +191,7 @@ sub valid_edit {
}
};
$c->redirect_to( '/admin/organisations/' . $c->param('id') );
return 1;
}
@ -222,7 +222,7 @@ sub merge_list {
org_result => $org_result,
org_rs => $org_rs,
);
return 1;
}
@ -251,7 +251,7 @@ sub merge_detail {
org_result => $org_result,
target_result => $target_result,
);
return 1;
}
@ -309,7 +309,7 @@ sub merge_confirm {
}
$c->redirect_to(
'/admin/organisations/' . $org_id . '/merge/' . $target_id );
return 1;
}

View file

@ -59,7 +59,7 @@ sub transaction_data {
json => { json => { data => $transaction_data } },
html => { transaction_rs => encode_json($transaction_data) },
);
return 1;
}

View file

@ -12,7 +12,7 @@ sub idx {
my $token_rs = $c->result_set;
$token_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash( tokens => [ $token_rs->all ] );
return 1;
}
@ -45,7 +45,7 @@ sub create {
$c->result_set->create( { name => $token_name } );
}
$c->redirect_to('/admin/tokens');
return 1;
}
@ -62,7 +62,7 @@ sub get {
$c->flash( error => 'No Token found' );
$c->redirect_to('/admin/tokens');
}
return 1;
}
@ -95,7 +95,7 @@ sub update {
$c->flash( error => 'No Token found' );
$c->redirect_to('/admin/tokens');
}
return 1;
}
@ -113,7 +113,7 @@ sub del {
$c->flash( error => 'No Token found' );
}
$c->redirect_to('/admin/tokens');
return 1;
}

View file

@ -68,7 +68,7 @@ sub index {
count => $count,
},
);
return 1;
}
@ -86,7 +86,7 @@ sub read {
$c->flash( error => 'No transaction found' );
$c->redirect_to('/admin/transactions');
}
return 1;
}
@ -103,7 +103,7 @@ sub image {
else {
$c->reply->static('image/no_transaction.jpg');
}
return 1;
}
@ -126,7 +126,7 @@ sub delete {
$c->flash( error => 'No transaction found' );
$c->redirect_to('/admin/transactions');
}
return 1;
}

View file

@ -34,7 +34,7 @@ sub index {
}
);
$c->stash( user_rs => $user_rs );
return 1;
}
@ -63,14 +63,14 @@ sub read {
$c->flash( error => 'No User found' );
$c->redirect_to('/admin/users');
}
return 1;
}
## no critic (Subroutines::ProhibitBuiltinHomonyms)
sub update {
## use critic
my ($c, $error) = @_;
my ( $c, $error ) = @_;
my $id = $c->param('id');
@ -199,7 +199,7 @@ sub update {
}
$c->redirect_to( '/admin/users/' . $id );
return 1;
}

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 =
@ -139,7 +141,7 @@ sub post_logout {
message => 'Logged Out',
}
);
return 1;
}

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

@ -122,7 +122,7 @@ sub idx {
}
},
);
return 1;
}
@ -206,7 +206,7 @@ sub trail_load {
}
},
);
return 1;
}

View file

@ -9,7 +9,7 @@ sub index {
# if ( $c->is_user_authenticated ) {
# $c->redirect_to('/home');
# }
return 1;
}
@ -32,7 +32,7 @@ sub auth_login {
else {
$c->redirect_to('/');
}
return 1;
}
@ -41,13 +41,13 @@ sub auth_logout {
$c->logout;
$c->redirect_to('/');
return 1;
}
sub home {
my $c = shift;
return 1;
}