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

@ -55,7 +55,7 @@ sub run {
{ key => 'primary' },
);
}
return 1;
}

View file

@ -90,7 +90,7 @@ sub run {
}
}
}
return 1;
}

View file

@ -29,7 +29,7 @@ sub run {
);
$result->update( { distance => $distance } ) if defined $distance;
}
return 1;
}
@ -55,7 +55,7 @@ sub _set_lat_long_for_result {
);
}
}
return 1;
}

View file

@ -71,7 +71,7 @@ sub run {
}
}
}
return 1;
}

View file

@ -13,7 +13,7 @@ sub run {
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
$leaderboard_rs->recalculate_all;
return 1;
}

View file

@ -153,7 +153,7 @@ sub run {
$recur_result->update( { last_updated => $purchase_time } );
}
return 1;
}

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;
}

View file

@ -24,7 +24,7 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result($row);
}
return 1;
}
@ -47,7 +47,7 @@ sub _row_to_result {
return if $postcode_r->ward;
$postcode_r->update( { ward_id => $ward->id } );
return 1;
}

View file

@ -22,7 +22,7 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result($row);
}
return 1;
}
@ -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(
@ -58,7 +59,7 @@ sub _row_to_result {
}
}
);
return 1;
}

View file

@ -46,7 +46,7 @@ sub import_csv {
while ( my $row = $self->get_csv_line ) {
$self->_row_to_result( $row, $lcc_org );
}
return 1;
}
@ -183,7 +183,7 @@ sub _row_to_result {
),
}
);
return 1;
}

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
@ -176,7 +189,7 @@ sub register {
return b($html);
}
);
return 1;
}

View file

@ -24,7 +24,7 @@ sub register {
return sprintf( '£%.2f', $value / 100000 );
}
);
return 1;
}

View file

@ -34,7 +34,7 @@ sub register {
else {
$app->log->debug('No Minion Config');
}
return 1;
}

View file

@ -10,7 +10,7 @@ sub run {
csv_file => $filename,
schema => $self->app->schema
)->import_csv;
return 1;
}

View file

@ -10,7 +10,7 @@ sub run {
csv_file => $filename,
schema => $self->app->schema
)->import_csv;
return 1;
}

View file

@ -11,7 +11,7 @@ sub run {
schema => $self->app->schema,
target_entity_id => $entity_id,
)->import_csv;
return 1;
}

View file

@ -30,7 +30,7 @@ sub run {
}
}
}
return 1;
}

View file

@ -7,7 +7,7 @@ sub run {
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
$leaderboard_rs->recalculate_all;
return 1;
}

View file

@ -8,7 +8,7 @@ sub run {
for my $arg (@args) {
$self->job->app->log->debug($arg);
}
return 1;
}

View file

@ -71,7 +71,7 @@ sub register {
return;
}
);
return 1;
}

View file

@ -15,7 +15,7 @@ sub register {
}
}
);
return 1;
}

View file

@ -101,7 +101,7 @@ sub register {
);
$app->helper( validation_error => sub { _validation_error(@_) } );
return 1;
}

View file

@ -34,5 +34,5 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to( "entity", "Pear::LocalLoop::Schema::Result::Entity",
"entity_id", );
1;

View file

@ -146,7 +146,7 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}

View file

@ -103,7 +103,7 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}

View file

@ -99,7 +99,7 @@ sub sqlt_deploy_hook {
else {
$pending_field->{default_value} = \"false";
}
return 1;
}

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(
{},

View file

@ -92,7 +92,7 @@ sub recalculate_all {
warn "Unrecognised Set";
}
}
return 1;
}
@ -107,7 +107,7 @@ sub _recalculate_leaderboard {
$lb_result->create_new($date);
}
);
return 1;
}

View file

@ -207,7 +207,7 @@ sub cmd_write_ddl {
}
);
}
return 1;
}
@ -227,7 +227,7 @@ sub cmd_install_dh {
version => $self->version,
}
);
return 1;
}
@ -245,7 +245,7 @@ sub cmd_install {
version => $self->version,
}
);
return 1;
}
@ -259,7 +259,7 @@ sub cmd_upgrade {
my ($self) = @_;
$self->dh->upgrade;
return 1;
}

View file

@ -14,7 +14,7 @@ sub BUILD {
or die "you need Test::PostgreSQL to run PG testing";
Test::PostgreSQL->import;
}
return 1;
}
@ -25,7 +25,7 @@ sub DEMOLISH {
$self->mojo->app->schema->storage->dbh->disconnect;
$self->pg->stop;
}
return 1;
}
@ -145,7 +145,7 @@ sub register_customer {
$self->framework->post_ok( '/api/register' => json => $json )
->status_is(200)->or( $self->dump_error )
->json_is( '/success', Mojo::JSON->true )->or( $self->dump_error );
return 1;
}
@ -157,7 +157,7 @@ sub register_organisation {
$self->framework->post_ok( '/api/register' => json => $args )
->status_is(200)->or( $self->dump_error )
->json_is( '/success', Mojo::JSON->true )->or( $self->dump_error );
return 1;
}
@ -180,7 +180,7 @@ sub logout {
'/api/logout' => json => { session_key => $session_key } )
->status_is(200)->json_is( '/success', Mojo::JSON->true )
->json_like( '/message', qr/Logged Out/ );
return 1;
}
@ -251,7 +251,7 @@ sub install_fixtures {
}
);
}
return 1;
}