This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm

57 lines
792 B
Perl
Raw Normal View History

2017-11-13 13:30:33 +00:00
package Pear::LocalLoop::Schema::ResultSet::ImportSet;
use strict;
use warnings;
use base 'DBIx::Class::ResultSet';
sub get_values {
my $self = shift;
my $id = shift;
return $self->find($id)->search_related(
'values',
undef,
{
2017-11-13 19:00:34 +00:00
order_by => { '-asc' => 'id' },
2017-11-13 13:30:33 +00:00
},
);
}
sub get_users {
my $self = shift;
my $id = shift;
return $self->get_values($id)->search({},
{
group_by => 'user_name',
},
);
}
sub get_orgs {
my $self = shift;
my $id = shift;
return $self->get_values($id)->search({},
{
group_by => 'org_name',
},
);
}
2017-11-13 19:00:34 +00:00
sub get_lookups {
my $self = shift;
my $id = shift;
return $self->find($id)->search_related(
'lookups',
undef,
{
order_by => { '-asc' => 'id' },
},
);
}
2017-11-13 13:30:33 +00:00
1;