新增:仓库标签详情接口
This commit is contained in:
parent
c4829333a8
commit
cc050e9c19
|
|
@ -79,6 +79,7 @@ func Routers(ctx gocontext.Context) *web.Route {
|
||||||
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode))
|
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeCode))
|
||||||
m.Group("/tags", func() {
|
m.Group("/tags", func() {
|
||||||
m.Get("", repo.ListTags)
|
m.Get("", repo.ListTags)
|
||||||
|
m.Get("/*", repo.GetTag)
|
||||||
}, reqRepoReader(unit_model.TypeCode), context.ReferencesGitRepo(true))
|
}, reqRepoReader(unit_model.TypeCode), context.ReferencesGitRepo(true))
|
||||||
m.Group("/wikies", func() {
|
m.Group("/wikies", func() {
|
||||||
m.Combo("").Get(repo.ListWikiPages).
|
m.Combo("").Get(repo.ListWikiPages).
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,20 @@ func ListTags(ctx *context.APIContext) {
|
||||||
ctx.JSON(http.StatusOK, &apiTags)
|
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 := 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) {
|
func BranchTagCount(ctx *context.APIContext) {
|
||||||
_, tagsTotal, err := ctx.Repo.GitRepo.GetTagInfos(0, 0)
|
_, tagsTotal, err := ctx.Repo.GitRepo.GetTagInfos(0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue