Update repository api

dev_forge
Jasder 5 years ago
parent ea63c0d74d
commit f17f7306a9

@ -453,11 +453,11 @@ curl -X GET http://localhost:3000/api/projects/3263 | jq
#### 修改项目信息
```
PUT api/projects/:id
PATCH api/projects/:id
```
*示例*
```
curl -X PUT \
curl -X PATCH \
-d "name=hnfl_demo" \
-d "description=my first project" \
-d "repository_name=hnfl_demo" \
@ -720,7 +720,7 @@ http://localhost:3000/api/18816895620/mirror_demo/entries | jq
|name |string|文件夹或文件名称|
|path |string|文件夹或文件相对路径|
|type |string|文件类型, file:文件dir文件目录|
|size |int|文件夹或文件大小 单位KB|
|size |int|文件夹或文件大小 单位B|
|content |string|文件内容,|
|target |string|标签|
@ -1284,7 +1284,14 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
|praised |boolean|当前登录用户是否已点赞true:已点赞fasle:未点赞, 用户未登录状态为null|
|watched |boolean|当前登录用户是否已关注true:已关注fasle:未关注, 用户未登录状态为null|
|permission |string|当前登录用户对该仓库的操作权限, Manager:管理员,可以在线编辑文件、在线新建文件、可以设置仓库的基本信息; Developer:开发人员,可在线编辑文件、在线新建文件、不能设置仓库信息; Reporter: 报告人员只能查看信息不能设置仓库信息、不能在线编辑文件、不能在线新建文件用户未登录时也会返回Reporter, 说明也只有读取文件的权限 |
|size |int|仓库文件大小单位KB|
|mirror_url |string|镜像地址, 只有通过镜像过来的项目才会有这个地址|
|ssh_url |string|仓库ssh地址|
|clone_url |string|仓库克隆地址|
|empty |boolean|仓库是否为空true: 空仓库false: 非空仓库|
|private |boolean|仓库是否私有true: 私有仓库fasle: 非私有的|
|default_branch |string|仓库默认分支|
|full_name |string|仓库全名(带用户名)|
|author |object|提交用户|
|-- login |string|用户名称|
|-- image_url |string|用户头像|
@ -1293,18 +1300,26 @@ http://localhost:3000/api/18816895620/mirror_demo | jq
返回值
```
{
"identifier": "mirror_demo",
"project_id": 3263,
"project_identifier": "mirror_demo",
"identifier": "mirror_demo",
"praises_count": 1,
"forked_count": 0,
"watchers_count": 1,
"branches_count": 6,
"commits_count": 105,
"commits_count": 107,
"permission": "Manager",
"mirror_url": "https://gitea.com/CasperVector/slew.git",
"watched": true,
"praised": true,
"mirror_url": "https://gitea.com/CasperVector/slew.git",
"size": 446,
"ssh_url": "jasder@localhost:18816895620/mirror_demo.git",
"clone_url": "http://localhost:3003/18816895620/mirror_demo.git",
"default_branch": "master",
"empty": false,
"full_name": "18816895620/mirror_demo",
"mirror": false,
"private": false,
"author": {
"name": "18816895620",
"image_url": "avatars/User/b"

@ -6,6 +6,10 @@ class RepositoriesController < ApplicationController
@project = @repo.project
@branches_count = Gitea::Repository::BranchesService.new(@user, @repo.identifier).call.size
@commits_count = Gitea::Repository::Commits::ListService.new(@user, @repo.identifier).call[:total_count]
@result = Gitea::Repository::GetService.new(@user, @repo.identifier).call
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)
end
def entries

@ -10,4 +10,12 @@ json.permission render_edit_project_permission(current_user, @project)
json.mirror_url @repo.mirror_url
json.watched current_user&.watched?(@project)
json.praised current_user&.liked?(@project)
json.size @result['size']
json.ssh_url @result['ssh_url']
json.clone_url @result['clone_url']
json.default_branch @result['default_branch']
json.empty @result['empty']
json.full_name @result['full_name']
json.mirror @result['mirror']
json.private @result['private']
json.partial! 'author', locals: { user: @repo.user }

Loading…
Cancel
Save