mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Add name filter to API for GetMilestoneList (#12336)
Adds a name filter to the API for GetMilestoneList Includes a small refactor: merge GetMilestones and GetMilestonesByRepoID Close #12260 Needed for https://gitea.com/gitea/go-sdk/issues/383 and https://gitea.com/gitea/tea/pulls/149
This commit is contained in:
parent
78cbd0ca72
commit
8bdc9795d8
8 changed files with 115 additions and 36 deletions
|
@ -39,6 +39,10 @@ func ListMilestones(ctx *context.APIContext) {
|
|||
// in: query
|
||||
// description: Milestone state, Recognised values are open, closed and all. Defaults to "open"
|
||||
// type: string
|
||||
// - name: name
|
||||
// in: query
|
||||
// description: filter by milestone name
|
||||
// type: string
|
||||
// - name: page
|
||||
// in: query
|
||||
// description: page number of results to return (1-based)
|
||||
|
@ -51,9 +55,14 @@ func ListMilestones(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/MilestoneList"
|
||||
|
||||
milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")), utils.GetListOptions(ctx))
|
||||
milestones, err := models.GetMilestones(models.GetMilestonesOption{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
State: api.StateType(ctx.Query("state")),
|
||||
Name: ctx.Query("name"),
|
||||
})
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetMilestonesByRepoID", err)
|
||||
ctx.Error(http.StatusInternalServerError, "GetMilestones", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue