From 6bfd516d76c07341a608c067e87b7a87c089f0d0 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 21 Apr 2017 20:03:51 +0100 Subject: [PATCH] Remove more old helpers and deprecate db helper --- lib/Pear/LocalLoop.pm | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/lib/Pear/LocalLoop.pm b/lib/Pear/LocalLoop.pm index 772f8ff..faea104 100644 --- a/lib/Pear/LocalLoop.pm +++ b/lib/Pear/LocalLoop.pm @@ -50,7 +50,7 @@ sub startup { }); # shortcut for use in template - $self->helper( db => sub { $self->app->schema->storage->dbh }); + $self->helper( db => sub { warn "DEPRECATED db helper"; return $self->app->schema->storage->dbh }); $self->helper( schema => sub { $self->app->schema }); $self->helper( api_validation_error => sub { @@ -150,22 +150,6 @@ sub startup { $self->res->headers->header('Access-Control-Allow-Origin' => '*') if $self->app->mode eq 'development'; }); - $self->helper( is_admin => sub { - my ($c, $user_id) = @_; - my $admin = $c->schema->resultset('Administrator')->find($user_id); - return defined $admin; - }); - - $self->helper( create_hash => sub{ - my ($self, $id, $name, $fullAddress, $postcode) = @_; - - return { - id => $id, - name => $name, - fullAddress => $fullAddress . ", " . $postcode, - } - }); - $self->helper(get_active_user_id => sub { my $self = shift; @@ -223,12 +207,7 @@ sub startup { return Data::UUID->new->create_str(); }); - $self->helper(does_organisational_id_exist => sub { - my ( $c, $org_id ) = @_; - return defined $c->schema->resultset('Organisation')->find({ organisationalid => $org_id }); - }); - - $self->helper(get_age_foreign_key => sub { + $self->helper(get_age_foreign_key => sub { my ( $c, $age_string ) = @_; my $age_range = $c->schema->resultset('AgeRange')->find({ agerangestring => $age_string }); return defined $age_range ? $age_range->agerangeid : undef;