add path and path_with_namespace to api project entity
This commit is contained in:
parent
563c55eb7e
commit
193a5624b2
17 changed files with 134 additions and 5 deletions
|
@ -8,7 +8,6 @@
|
||||||
# description :text
|
# description :text
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# private_flag :boolean default(TRUE), not null
|
|
||||||
# creator_id :integer
|
# creator_id :integer
|
||||||
# default_branch :string(255)
|
# default_branch :string(255)
|
||||||
# issues_enabled :boolean default(TRUE), not null
|
# issues_enabled :boolean default(TRUE), not null
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
# merge_requests_enabled :boolean default(TRUE), not null
|
# merge_requests_enabled :boolean default(TRUE), not null
|
||||||
# wiki_enabled :boolean default(TRUE), not null
|
# wiki_enabled :boolean default(TRUE), not null
|
||||||
# namespace_id :integer
|
# namespace_id :integer
|
||||||
|
# public :boolean default(FALSE), not null
|
||||||
#
|
#
|
||||||
|
|
||||||
require "grit"
|
require "grit"
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
# extern_uid :string(255)
|
# extern_uid :string(255)
|
||||||
# provider :string(255)
|
# provider :string(255)
|
||||||
# username :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
|
class User < ActiveRecord::Base
|
||||||
|
|
|
@ -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
|
class UserTeam < ActiveRecord::Base
|
||||||
attr_accessible :name, :owner_id, :path
|
attr_accessible :name, :owner_id, :path
|
||||||
|
|
||||||
|
|
|
@ -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
|
class UserTeamProjectRelationship < ActiveRecord::Base
|
||||||
attr_accessible :greatest_access, :project_id, :user_team_id
|
attr_accessible :greatest_access, :project_id, :user_team_id
|
||||||
|
|
||||||
|
|
|
@ -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
|
class UserTeamUserRelationship < ActiveRecord::Base
|
||||||
attr_accessible :group_admin, :permission, :user_id, :user_team_id
|
attr_accessible :group_admin, :permission, :user_id, :user_team_id
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# 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|
|
create_table "events", :force => true do |t|
|
||||||
t.string "target_type"
|
t.string "target_type"
|
||||||
|
@ -147,7 +147,6 @@ ActiveRecord::Schema.define(:version => 20130125090214) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "private_flag", :default => true, :null => false
|
|
||||||
t.integer "creator_id"
|
t.integer "creator_id"
|
||||||
t.string "default_branch"
|
t.string "default_branch"
|
||||||
t.boolean "issues_enabled", :default => true, :null => false
|
t.boolean "issues_enabled", :default => true, :null => false
|
||||||
|
|
|
@ -22,6 +22,8 @@ GET /projects
|
||||||
"created_at": "2012-05-23T08:00:58Z"
|
"created_at": "2012-05-23T08:00:58Z"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"path": "rails",
|
||||||
|
"path_with_namespace": "rails/rails",
|
||||||
"issues_enabled": false,
|
"issues_enabled": false,
|
||||||
"merge_requests_enabled": false,
|
"merge_requests_enabled": false,
|
||||||
"wall_enabled": true,
|
"wall_enabled": true,
|
||||||
|
@ -42,6 +44,8 @@ GET /projects
|
||||||
"created_at": "2012-05-23T08:00:58Z"
|
"created_at": "2012-05-23T08:00:58Z"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"path": "gitlab",
|
||||||
|
"path_with_namespace": "randx/gitlab",
|
||||||
"issues_enabled": true,
|
"issues_enabled": true,
|
||||||
"merge_requests_enabled": true,
|
"merge_requests_enabled": true,
|
||||||
"wall_enabled": true,
|
"wall_enabled": true,
|
||||||
|
@ -78,6 +82,8 @@ Parameters:
|
||||||
"created_at": "2012-05-23T08:00:58Z"
|
"created_at": "2012-05-23T08:00:58Z"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"path": "gitlab",
|
||||||
|
"path_with_namespace": "randx/gitlab",
|
||||||
"issues_enabled": true,
|
"issues_enabled": true,
|
||||||
"merge_requests_enabled": true,
|
"merge_requests_enabled": true,
|
||||||
"wall_enabled": true,
|
"wall_enabled": true,
|
||||||
|
|
|
@ -21,6 +21,7 @@ module Gitlab
|
||||||
expose :id, :name, :description, :default_branch
|
expose :id, :name, :description, :default_branch
|
||||||
expose :owner, using: Entities::UserBasic
|
expose :owner, using: Entities::UserBasic
|
||||||
expose :private_flag, as: :private
|
expose :private_flag, as: :private
|
||||||
|
expose :path, :path_with_namespace
|
||||||
expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
|
expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
|
||||||
expose :namespace
|
expose :namespace
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
|
|
@ -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
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
|
|
@ -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
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
# description :text
|
# description :text
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# private_flag :boolean default(TRUE), not null
|
|
||||||
# creator_id :integer
|
# creator_id :integer
|
||||||
# default_branch :string(255)
|
# default_branch :string(255)
|
||||||
# issues_enabled :boolean default(TRUE), not null
|
# issues_enabled :boolean default(TRUE), not null
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
# merge_requests_enabled :boolean default(TRUE), not null
|
# merge_requests_enabled :boolean default(TRUE), not null
|
||||||
# wiki_enabled :boolean default(TRUE), not null
|
# wiki_enabled :boolean default(TRUE), not null
|
||||||
# namespace_id :integer
|
# namespace_id :integer
|
||||||
|
# public :boolean default(FALSE), not null
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
@ -42,7 +42,6 @@ describe Project do
|
||||||
describe "Mass assignment" do
|
describe "Mass assignment" do
|
||||||
it { should_not allow_mass_assignment_of(:namespace_id) }
|
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(:creator_id) }
|
||||||
it { should_not allow_mass_assignment_of(:private_flag) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Validation" do
|
describe "Validation" do
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
# extern_uid :string(255)
|
# extern_uid :string(255)
|
||||||
# provider :string(255)
|
# provider :string(255)
|
||||||
# username :string(255)
|
# username :string(255)
|
||||||
|
# can_create_group :boolean default(TRUE), not null
|
||||||
|
# can_create_team :boolean default(TRUE), not null
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
|
@ -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'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe UserTeamProjectRelationship do
|
describe UserTeamProjectRelationship do
|
||||||
|
|
|
@ -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'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe UserTeam do
|
describe UserTeam do
|
||||||
|
|
|
@ -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'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe UserTeamUserRelationship do
|
describe UserTeamUserRelationship do
|
||||||
|
|
Loading…
Reference in a new issue