FIX update repositories api

dev_forge
Jasder 5 years ago
parent 8050394f00
commit fb8d012e22

@ -915,6 +915,8 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
|praises_count |int|点赞数量|
|forked_count |int|fork数量|
|watchers_count |int|关注数量|
|branches_count |int|分支数量|
|commits_count |int|总提交记录数量|
|author |object|提交用户|
|-- login |string|用户名称|
|-- image_url |string|用户头像|
@ -927,6 +929,8 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
"praises_count": 0,
"forked_count": 0,
"watchers_count": 0,
"branches_count": 4,
"commits_count": 81,
"author": {
"name": "18816895620",
"image_url": "avatars/User/b"

@ -3,6 +3,8 @@ class RepositoriesController < ApplicationController
before_action :find_user, :find_repository, :authorizate!
def show
@branches_count = Gitea::Repository::BranchesService.new(@user, @repo.identifier).call.size
@commits_count = Gitea::Repository::Commits::ListService.new(@user, @repo.identifier).call[:total_count]
end
def entries

@ -2,4 +2,6 @@ json.identifier @repo.identifier
json.praises_count @repo.project.praises_count
json.forked_count @repo.project.forked_count
json.watchers_count @repo.project.watchers_count
json.branches_count @branches_count
json.commits_count @commits_count
json.partial! 'author', locals: { user: @repo.user }

Loading…
Cancel
Save