更改:blame接口响应结构体
This commit is contained in:
parent
484a4ce01a
commit
a6a662c6e3
|
@ -9,6 +9,13 @@ import (
|
|||
hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
|
||||
)
|
||||
|
||||
type APIBlameResponse struct {
|
||||
FileSize int64 `json:"file_size"`
|
||||
FileName string `json:"file_name"`
|
||||
NumberLines int `json:"num_lines"`
|
||||
BlameParts []hat_api.BlamePart `json:"blame_parts"`
|
||||
}
|
||||
|
||||
func GetRepoRefBlame(ctx *context.APIContext) {
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.NotFound()
|
||||
|
@ -64,8 +71,10 @@ func GetRepoRefBlame(ctx *context.APIContext) {
|
|||
blameParts = append(blameParts, *blamePart)
|
||||
currentNumber += blamePart.EffectLine
|
||||
}
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"num_lines": numLines,
|
||||
"blame_parts": blameParts,
|
||||
ctx.JSON(http.StatusOK, APIBlameResponse{
|
||||
FileSize: blob.Size(),
|
||||
FileName: blob.Name(),
|
||||
NumberLines: numLines,
|
||||
BlameParts: blameParts,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue