新增:仓库标签详情接口
This commit is contained in:
parent
86bd9b67b6
commit
eca533c81a
|
@ -136,6 +136,7 @@ func Routers(ctx gocontext.Context) *web.Route {
|
|||
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode))
|
||||
m.Group("/tags", func() {
|
||||
m.Get("", repo.ListTags)
|
||||
m.Get("/*", repo.GetTag)
|
||||
}, reqRepoReader(unit_model.TypeCode), context.ReferencesGitRepo(true))
|
||||
m.Group("/readme", func() {
|
||||
m.Get("", repo.GetReadmeContents)
|
||||
|
|
|
@ -44,6 +44,20 @@ func ListTags(ctx *context.APIContext) {
|
|||
ctx.JSON(http.StatusOK, &apiTags)
|
||||
}
|
||||
|
||||
func GetTag(ctx *context.APIContext) {
|
||||
tagName := ctx.Params("*")
|
||||
tag, err := ctx.Repo.GitRepo.GetTag(tagName)
|
||||
if err != nil {
|
||||
ctx.NotFound(tagName)
|
||||
}
|
||||
|
||||
apiTag, err := hat_convert.ToTag(ctx.Repo.Repository, ctx.Repo.GitRepo, tag)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "hat_convert.ToTag", err)
|
||||
}
|
||||
ctx.JSON(http.StatusOK, apiTag)
|
||||
}
|
||||
|
||||
func BranchTagCount(ctx *context.APIContext) {
|
||||
_, tagsTotal, err := ctx.Repo.GitRepo.GetTagInfos(0, 0)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue