OSDN Git Service

add path and path_with_namespace to api project entity
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 31 Jan 2013 07:11:35 +0000 (09:11 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 31 Jan 2013 07:11:35 +0000 (09:11 +0200)
17 files changed:
app/models/project.rb
app/models/user.rb
app/models/user_team.rb
app/models/user_team_project_relationship.rb
app/models/user_team_user_relationship.rb
db/migrate/20130131070232_remove_private_flag_from_project.rb [new file with mode: 0644]
db/schema.rb
doc/api/projects.md
lib/api/entities.rb
spec/factories/user_team_project_relationships.rb
spec/factories/user_team_user_relationships.rb
spec/factories/user_teams.rb
spec/models/project_spec.rb
spec/models/user_spec.rb
spec/models/user_team_project_relationship_spec.rb
spec/models/user_team_spec.rb
spec/models/user_team_user_relationship_spec.rb

index dde1592..6a3d7ab 100644 (file)
@@ -8,7 +8,6 @@
 #  description            :text
 #  created_at             :datetime         not null
 #  updated_at             :datetime         not null
-#  private_flag           :boolean          default(TRUE), not null
 #  creator_id             :integer
 #  default_branch         :string(255)
 #  issues_enabled         :boolean          default(TRUE), not null
@@ -16,6 +15,7 @@
 #  merge_requests_enabled :boolean          default(TRUE), not null
 #  wiki_enabled           :boolean          default(TRUE), not null
 #  namespace_id           :integer
+#  public                 :boolean          default(FALSE), not null
 #
 
 require "grit"
index 5a95dee..5b0df09 100644 (file)
@@ -31,6 +31,8 @@
 #  extern_uid             :string(255)
 #  provider               :string(255)
 #  username               :string(255)
+#  can_create_group       :boolean          default(TRUE), not null
+#  can_create_team        :boolean          default(TRUE), not null
 #
 
 class User < ActiveRecord::Base
index b28a6a0..dc8cf9e 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_teams
+#
+#  id         :integer          not null, primary key
+#  name       :string(255)
+#  path       :string(255)
+#  owner_id   :integer
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
 class UserTeam < ActiveRecord::Base
   attr_accessible :name, :owner_id, :path
 
index 1b0368c..a7aa889 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_team_project_relationships
+#
+#  id              :integer          not null, primary key
+#  project_id      :integer
+#  user_team_id    :integer
+#  greatest_access :integer
+#  created_at      :datetime         not null
+#  updated_at      :datetime         not null
+#
+
 class UserTeamProjectRelationship < ActiveRecord::Base
   attr_accessible :greatest_access, :project_id, :user_team_id
 
index 63bdc49..1f7e262 100644 (file)
@@ -1,3 +1,16 @@
+# == Schema Information
+#
+# Table name: user_team_user_relationships
+#
+#  id           :integer          not null, primary key
+#  user_id      :integer
+#  user_team_id :integer
+#  group_admin  :boolean
+#  permission   :integer
+#  created_at   :datetime         not null
+#  updated_at   :datetime         not null
+#
+
 class UserTeamUserRelationship < ActiveRecord::Base
   attr_accessible :group_admin, :permission, :user_id, :user_team_id
 
diff --git a/db/migrate/20130131070232_remove_private_flag_from_project.rb b/db/migrate/20130131070232_remove_private_flag_from_project.rb
new file mode 100644 (file)
index 0000000..5754db1
--- /dev/null
@@ -0,0 +1,9 @@
+class RemovePrivateFlagFromProject < ActiveRecord::Migration
+  def up
+    remove_column :projects, :private_flag
+  end
+
+  def down
+    add_column :projects, :private_flag, :boolean, default: true, null: false
+  end
+end
index 144f4a5..0f07d2b 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20130125090214) do
+ActiveRecord::Schema.define(:version => 20130131070232) do
 
   create_table "events", :force => true do |t|
     t.string   "target_type"
@@ -147,7 +147,6 @@ ActiveRecord::Schema.define(:version => 20130125090214) do
     t.text     "description"
     t.datetime "created_at",                                :null => false
     t.datetime "updated_at",                                :null => false
-    t.boolean  "private_flag",           :default => true,  :null => false
     t.integer  "creator_id"
     t.string   "default_branch"
     t.boolean  "issues_enabled",         :default => true,  :null => false
index 4112867..82bb0c0 100644 (file)
@@ -22,6 +22,8 @@ GET /projects
       "created_at": "2012-05-23T08:00:58Z"
     },
     "private": true,
+    "path": "rails",
+    "path_with_namespace": "rails/rails",
     "issues_enabled": false,
     "merge_requests_enabled": false,
     "wall_enabled": true,
@@ -42,6 +44,8 @@ GET /projects
       "created_at": "2012-05-23T08:00:58Z"
     },
     "private": true,
+    "path": "gitlab",
+    "path_with_namespace": "randx/gitlab",
     "issues_enabled": true,
     "merge_requests_enabled": true,
     "wall_enabled": true,
@@ -78,6 +82,8 @@ Parameters:
     "created_at": "2012-05-23T08:00:58Z"
   },
   "private": true,
+  "path": "gitlab",
+  "path_with_namespace": "randx/gitlab",
   "issues_enabled": true,
   "merge_requests_enabled": true,
   "wall_enabled": true,
index 80e2954..3637464 100644 (file)
@@ -21,6 +21,7 @@ module Gitlab
       expose :id, :name, :description, :default_branch
       expose :owner, using: Entities::UserBasic
       expose :private_flag, as: :private
+      expose :path, :path_with_namespace
       expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
       expose :namespace
     end
index 93c7b57..e900d86 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_team_project_relationships
+#
+#  id              :integer          not null, primary key
+#  project_id      :integer
+#  user_team_id    :integer
+#  greatest_access :integer
+#  created_at      :datetime         not null
+#  updated_at      :datetime         not null
+#
+
 # Read about factories at https://github.com/thoughtbot/factory_girl
 
 FactoryGirl.define do
index 55179f9..8c729dd 100644 (file)
@@ -1,3 +1,16 @@
+# == Schema Information
+#
+# Table name: user_team_user_relationships
+#
+#  id           :integer          not null, primary key
+#  user_id      :integer
+#  user_team_id :integer
+#  group_admin  :boolean
+#  permission   :integer
+#  created_at   :datetime         not null
+#  updated_at   :datetime         not null
+#
+
 # Read about factories at https://github.com/thoughtbot/factory_girl
 
 FactoryGirl.define do
index f4fe45c..1a9ae8e 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_teams
+#
+#  id         :integer          not null, primary key
+#  name       :string(255)
+#  path       :string(255)
+#  owner_id   :integer
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
 # Read about factories at https://github.com/thoughtbot/factory_girl
 
 FactoryGirl.define do
index 17bc988..6e67ca8 100644 (file)
@@ -8,7 +8,6 @@
 #  description            :text
 #  created_at             :datetime         not null
 #  updated_at             :datetime         not null
-#  private_flag           :boolean          default(TRUE), not null
 #  creator_id             :integer
 #  default_branch         :string(255)
 #  issues_enabled         :boolean          default(TRUE), not null
@@ -16,6 +15,7 @@
 #  merge_requests_enabled :boolean          default(TRUE), not null
 #  wiki_enabled           :boolean          default(TRUE), not null
 #  namespace_id           :integer
+#  public                 :boolean          default(FALSE), not null
 #
 
 require 'spec_helper'
@@ -42,7 +42,6 @@ describe Project do
   describe "Mass assignment" do
     it { should_not allow_mass_assignment_of(:namespace_id) }
     it { should_not allow_mass_assignment_of(:creator_id) }
-    it { should_not allow_mass_assignment_of(:private_flag) }
   end
 
   describe "Validation" do
index 2ca82ed..8ab0a03 100644 (file)
@@ -31,6 +31,8 @@
 #  extern_uid             :string(255)
 #  provider               :string(255)
 #  username               :string(255)
+#  can_create_group       :boolean          default(TRUE), not null
+#  can_create_team        :boolean          default(TRUE), not null
 #
 
 require 'spec_helper'
index 81051d5..86150cf 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_team_project_relationships
+#
+#  id              :integer          not null, primary key
+#  project_id      :integer
+#  user_team_id    :integer
+#  greatest_access :integer
+#  created_at      :datetime         not null
+#  updated_at      :datetime         not null
+#
+
 require 'spec_helper'
 
 describe UserTeamProjectRelationship do
index 2d1b99d..76d47f4 100644 (file)
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: user_teams
+#
+#  id         :integer          not null, primary key
+#  name       :string(255)
+#  path       :string(255)
+#  owner_id   :integer
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
 require 'spec_helper'
 
 describe UserTeam do
index 309f197..981ad1e 100644 (file)
@@ -1,3 +1,16 @@
+# == Schema Information
+#
+# Table name: user_team_user_relationships
+#
+#  id           :integer          not null, primary key
+#  user_id      :integer
+#  user_team_id :integer
+#  group_admin  :boolean
+#  permission   :integer
+#  created_at   :datetime         not null
+#  updated_at   :datetime         not null
+#
+
 require 'spec_helper'
 
 describe UserTeamUserRelationship do