Cleanup Project model

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy
2013-10-24 10:42:01 -04:00
parent ee8275cfdb
commit 78dcd3e619
3 changed files with 26 additions and 25 deletions

View File

@ -12,20 +12,10 @@ sub projectChain :Chained('/') :PathPart('project') :CaptureArgs(1) {
my ($self, $c, $projectName) = @_;
$c->stash->{params}->{name} //= $projectName;
$c->stash->{project} = $c->model('DB::Projects')->find($projectName, { columns => [
"me.name",
"me.displayname",
"me.description",
"me.enabled",
"me.hidden",
"me.homepage",
"owner.username",
"owner.fullname",
"releases.name",
"releases.timestamp",
"jobsets.name",
"jobsets.enabled",
], join => [ 'owner', 'releases', 'jobsets' ], order_by => { -desc => "releases.timestamp" }, collapse => 1 });
$c->stash->{project} = $c->model('DB::Projects')->find($projectName, {
join => [ 'releases' ],
order_by => { -desc => "releases.timestamp" },
});
notFound($c, "Project $projectName doesn't exist.")
if !$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT");

View File

@ -284,13 +284,24 @@ __PACKAGE__->many_to_many("usernames", "projectmembers", "username");
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PdNQ2mf5azBB6nI+iAm8fQ
# These lines were loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Projects.pm' found in @INC.
# They are now part of the custom portion of this file
# for you to hand-edit. If you do not either delete
# this section or remove that file from @INC, this section
# will be repeated redundantly when you re-create this
# file again via Loader! See skip_load_external to disable
# this feature.
# You can replace this text with custom content, and it will be preserved on regeneration
my %hint = (
columns => [
"name",
"displayname",
"description",
"enabled",
"hidden",
"owner"
],
relations => {
releases => "name",
jobsets => "name"
}
);
sub json_hint {
return \%hint;
}
1;