dev_forge
sylor_huang@126.com 5 years ago
commit 567d20caea

@ -1281,6 +1281,8 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
|watchers_count |int|关注数量|
|branches_count |int|分支数量|
|commits_count |int|总提交记录数量|
|issues_count |int|总提交记录数量|
|pull_requests_count |int|总提交记录数量|
|praised |boolean|当前登录用户是否已点赞true:已点赞fasle:未点赞, 用户未登录状态为null|
|watched |boolean|当前登录用户是否已关注true:已关注fasle:未关注, 用户未登录状态为null|
|permission |string|当前登录用户对该仓库的操作权限, Manager:管理员,可以在线编辑文件、在线新建文件、可以设置仓库的基本信息; Developer:开发人员,可在线编辑文件、在线新建文件、不能设置仓库信息; Reporter: 报告人员只能查看信息不能设置仓库信息、不能在线编辑文件、不能在线新建文件用户未登录时也会返回Reporter, 说明也只有读取文件的权限 |
@ -1308,6 +1310,8 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
"watchers_count": 1,
"branches_count": 6,
"commits_count": 107,
"issues_count": 0,
"pull_requests_count": 0,
"permission": "Manager",
"mirror_url": "https://gitea.com/CasperVector/slew.git",
"watched": true,

@ -1,6 +1,6 @@
class Issue < ApplicationRecord
#issue_type 1为普通2为悬赏
belongs_to :project
belongs_to :project, :counter_cache => true
belongs_to :tracker,optional: true
has_many :project_trends, as: :trend, dependent: :destroy
has_one :pull_request

@ -2,7 +2,7 @@ class PullRequest < ApplicationRecord
#status 0 默认未合并, 1表示合并, 2表示请求拒绝
belongs_to :issue
belongs_to :user
belongs_to :project
belongs_to :project, :counter_cache => true
has_many :pull_request_assigns, foreign_key: :pull_request_id
has_many :pull_request_tags, foreign_key: :pull_request_id
has_many :project_trends, as: :trend, dependent: :destroy

@ -0,0 +1,6 @@
class AddIssuesCountAndPullRequestsCountToProjects < ActiveRecord::Migration[5.2]
def change
add_column :projects, :issues_count, :integer, :default => 0
add_column :projects, :pull_requests_count, :integer, :default => 0
end
end
Loading…
Cancel
Save