summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/milestone.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-05-12 23:54:35 +0200
committerGitHub <noreply@github.com>2020-05-12 22:54:35 +0100
commit7257c39ddfe9d9d424192e6bd307a70ed544f5be (patch)
tree67e2fb0861e0b5fe610e424c8b3906db438c6335 /routers/api/v1/repo/milestone.go
parentba40263fdda53446c7cae6e41885ebdee8bb7b52 (diff)
downloadgitea-7257c39ddfe9d9d424192e6bd307a70ed544f5be.tar.gz
gitea-7257c39ddfe9d9d424192e6bd307a70ed544f5be.zip
Refactor Milestone related (#11225)
Diffstat (limited to 'routers/api/v1/repo/milestone.go')
-rw-r--r--routers/api/v1/repo/milestone.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go
index 80d30e2c02..1bfd54df88 100644
--- a/routers/api/v1/repo/milestone.go
+++ b/routers/api/v1/repo/milestone.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/routers/api/v1/utils"
@@ -58,7 +59,7 @@ func ListMilestones(ctx *context.APIContext) {
apiMilestones := make([]*api.Milestone, len(milestones))
for i := range milestones {
- apiMilestones[i] = milestones[i].APIFormat()
+ apiMilestones[i] = convert.ToAPIMilestone(milestones[i])
}
ctx.JSON(http.StatusOK, &apiMilestones)
}
@@ -100,7 +101,7 @@ func GetMilestone(ctx *context.APIContext) {
}
return
}
- ctx.JSON(http.StatusOK, milestone.APIFormat())
+ ctx.JSON(http.StatusOK, convert.ToAPIMilestone(milestone))
}
// CreateMilestone create a milestone for a repository
@@ -147,7 +148,7 @@ func CreateMilestone(ctx *context.APIContext, form api.CreateMilestoneOption) {
ctx.Error(http.StatusInternalServerError, "NewMilestone", err)
return
}
- ctx.JSON(http.StatusCreated, milestone.APIFormat())
+ ctx.JSON(http.StatusCreated, convert.ToAPIMilestone(milestone))
}
// EditMilestone modify a milestone for a repository
@@ -213,7 +214,7 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) {
ctx.ServerError("UpdateMilestone", err)
return
}
- ctx.JSON(http.StatusOK, milestone.APIFormat())
+ ctx.JSON(http.StatusOK, convert.ToAPIMilestone(milestone))
}
// DeleteMilestone delete a milestone for a repository