Commit 193a5624b2daf4d638c382b88001d06535f57f2d
1 parent
563c55eb
Exists in
master
and in
4 other branches
add path and path_with_namespace to api project entity
Showing
17 changed files
with
134 additions
and
5 deletions
Show diff stats
app/models/project.rb
... | ... | @@ -8,7 +8,6 @@ |
8 | 8 | # description :text |
9 | 9 | # created_at :datetime not null |
10 | 10 | # updated_at :datetime not null |
11 | -# private_flag :boolean default(TRUE), not null | |
12 | 11 | # creator_id :integer |
13 | 12 | # default_branch :string(255) |
14 | 13 | # issues_enabled :boolean default(TRUE), not null |
... | ... | @@ -16,6 +15,7 @@ |
16 | 15 | # merge_requests_enabled :boolean default(TRUE), not null |
17 | 16 | # wiki_enabled :boolean default(TRUE), not null |
18 | 17 | # namespace_id :integer |
18 | +# public :boolean default(FALSE), not null | |
19 | 19 | # |
20 | 20 | |
21 | 21 | require "grit" | ... | ... |
app/models/user.rb
app/models/user_team.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_teams | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# name :string(255) | |
7 | +# path :string(255) | |
8 | +# owner_id :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | class UserTeam < ActiveRecord::Base |
2 | 14 | attr_accessible :name, :owner_id, :path |
3 | 15 | ... | ... |
app/models/user_team_project_relationship.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_project_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# project_id :integer | |
7 | +# user_team_id :integer | |
8 | +# greatest_access :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | class UserTeamProjectRelationship < ActiveRecord::Base |
2 | 14 | attr_accessible :greatest_access, :project_id, :user_team_id |
3 | 15 | ... | ... |
app/models/user_team_user_relationship.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_user_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# user_id :integer | |
7 | +# user_team_id :integer | |
8 | +# group_admin :boolean | |
9 | +# permission :integer | |
10 | +# created_at :datetime not null | |
11 | +# updated_at :datetime not null | |
12 | +# | |
13 | + | |
1 | 14 | class UserTeamUserRelationship < ActiveRecord::Base |
2 | 15 | attr_accessible :group_admin, :permission, :user_id, :user_team_id |
3 | 16 | ... | ... |
db/migrate/20130131070232_remove_private_flag_from_project.rb
0 → 100644
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20130125090214) do | |
14 | +ActiveRecord::Schema.define(:version => 20130131070232) do | |
15 | 15 | |
16 | 16 | create_table "events", :force => true do |t| |
17 | 17 | t.string "target_type" |
... | ... | @@ -147,7 +147,6 @@ ActiveRecord::Schema.define(:version => 20130125090214) do |
147 | 147 | t.text "description" |
148 | 148 | t.datetime "created_at", :null => false |
149 | 149 | t.datetime "updated_at", :null => false |
150 | - t.boolean "private_flag", :default => true, :null => false | |
151 | 150 | t.integer "creator_id" |
152 | 151 | t.string "default_branch" |
153 | 152 | t.boolean "issues_enabled", :default => true, :null => false | ... | ... |
doc/api/projects.md
... | ... | @@ -22,6 +22,8 @@ GET /projects |
22 | 22 | "created_at": "2012-05-23T08:00:58Z" |
23 | 23 | }, |
24 | 24 | "private": true, |
25 | + "path": "rails", | |
26 | + "path_with_namespace": "rails/rails", | |
25 | 27 | "issues_enabled": false, |
26 | 28 | "merge_requests_enabled": false, |
27 | 29 | "wall_enabled": true, |
... | ... | @@ -42,6 +44,8 @@ GET /projects |
42 | 44 | "created_at": "2012-05-23T08:00:58Z" |
43 | 45 | }, |
44 | 46 | "private": true, |
47 | + "path": "gitlab", | |
48 | + "path_with_namespace": "randx/gitlab", | |
45 | 49 | "issues_enabled": true, |
46 | 50 | "merge_requests_enabled": true, |
47 | 51 | "wall_enabled": true, |
... | ... | @@ -78,6 +82,8 @@ Parameters: |
78 | 82 | "created_at": "2012-05-23T08:00:58Z" |
79 | 83 | }, |
80 | 84 | "private": true, |
85 | + "path": "gitlab", | |
86 | + "path_with_namespace": "randx/gitlab", | |
81 | 87 | "issues_enabled": true, |
82 | 88 | "merge_requests_enabled": true, |
83 | 89 | "wall_enabled": true, | ... | ... |
lib/api/entities.rb
... | ... | @@ -21,6 +21,7 @@ module Gitlab |
21 | 21 | expose :id, :name, :description, :default_branch |
22 | 22 | expose :owner, using: Entities::UserBasic |
23 | 23 | expose :private_flag, as: :private |
24 | + expose :path, :path_with_namespace | |
24 | 25 | expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at |
25 | 26 | expose :namespace |
26 | 27 | end | ... | ... |
spec/factories/user_team_project_relationships.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_project_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# project_id :integer | |
7 | +# user_team_id :integer | |
8 | +# greatest_access :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | # Read about factories at https://github.com/thoughtbot/factory_girl |
2 | 14 | |
3 | 15 | FactoryGirl.define do | ... | ... |
spec/factories/user_team_user_relationships.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_user_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# user_id :integer | |
7 | +# user_team_id :integer | |
8 | +# group_admin :boolean | |
9 | +# permission :integer | |
10 | +# created_at :datetime not null | |
11 | +# updated_at :datetime not null | |
12 | +# | |
13 | + | |
1 | 14 | # Read about factories at https://github.com/thoughtbot/factory_girl |
2 | 15 | |
3 | 16 | FactoryGirl.define do | ... | ... |
spec/factories/user_teams.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_teams | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# name :string(255) | |
7 | +# path :string(255) | |
8 | +# owner_id :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | # Read about factories at https://github.com/thoughtbot/factory_girl |
2 | 14 | |
3 | 15 | FactoryGirl.define do | ... | ... |
spec/models/project_spec.rb
... | ... | @@ -8,7 +8,6 @@ |
8 | 8 | # description :text |
9 | 9 | # created_at :datetime not null |
10 | 10 | # updated_at :datetime not null |
11 | -# private_flag :boolean default(TRUE), not null | |
12 | 11 | # creator_id :integer |
13 | 12 | # default_branch :string(255) |
14 | 13 | # issues_enabled :boolean default(TRUE), not null |
... | ... | @@ -16,6 +15,7 @@ |
16 | 15 | # merge_requests_enabled :boolean default(TRUE), not null |
17 | 16 | # wiki_enabled :boolean default(TRUE), not null |
18 | 17 | # namespace_id :integer |
18 | +# public :boolean default(FALSE), not null | |
19 | 19 | # |
20 | 20 | |
21 | 21 | require 'spec_helper' |
... | ... | @@ -42,7 +42,6 @@ describe Project do |
42 | 42 | describe "Mass assignment" do |
43 | 43 | it { should_not allow_mass_assignment_of(:namespace_id) } |
44 | 44 | it { should_not allow_mass_assignment_of(:creator_id) } |
45 | - it { should_not allow_mass_assignment_of(:private_flag) } | |
46 | 45 | end |
47 | 46 | |
48 | 47 | describe "Validation" do | ... | ... |
spec/models/user_spec.rb
spec/models/user_team_project_relationship_spec.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_project_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# project_id :integer | |
7 | +# user_team_id :integer | |
8 | +# greatest_access :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | require 'spec_helper' |
2 | 14 | |
3 | 15 | describe UserTeamProjectRelationship do | ... | ... |
spec/models/user_team_spec.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_teams | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# name :string(255) | |
7 | +# path :string(255) | |
8 | +# owner_id :integer | |
9 | +# created_at :datetime not null | |
10 | +# updated_at :datetime not null | |
11 | +# | |
12 | + | |
1 | 13 | require 'spec_helper' |
2 | 14 | |
3 | 15 | describe UserTeam do | ... | ... |
spec/models/user_team_user_relationship_spec.rb
1 | +# == Schema Information | |
2 | +# | |
3 | +# Table name: user_team_user_relationships | |
4 | +# | |
5 | +# id :integer not null, primary key | |
6 | +# user_id :integer | |
7 | +# user_team_id :integer | |
8 | +# group_admin :boolean | |
9 | +# permission :integer | |
10 | +# created_at :datetime not null | |
11 | +# updated_at :datetime not null | |
12 | +# | |
13 | + | |
1 | 14 | require 'spec_helper' |
2 | 15 | |
3 | 16 | describe UserTeamUserRelationship do | ... | ... |