From fe5afcb0227db0aa9d8634564de385a328dfbced Mon Sep 17 00:00:00 2001 From: Gnanakeethan Balasubramaniam Date: Tue, 16 Sep 2025 10:02:03 +0530 Subject: [PATCH] Exposing TimeEstimate field in the API (#35475) Time Estimate field is not included in the issue modification webhooks or issue API endpoints. This PR fixes the field for the API. --------- Signed-off-by: Gnanakeethan Balasubramaniam Signed-off-by: Gnanakeethan Balasubramaniam --- modules/structs/issue.go | 2 ++ services/convert/issue.go | 2 ++ templates/swagger/v1_json.tmpl | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/modules/structs/issue.go b/modules/structs/issue.go index a6f41ab550..2540481d0f 100644 --- a/modules/structs/issue.go +++ b/modules/structs/issue.go @@ -76,6 +76,8 @@ type Issue struct { // swagger:strfmt date-time Deadline *time.Time `json:"due_date"` + TimeEstimate int64 `json:"time_estimate"` + PullRequest *PullRequestMeta `json:"pull_request"` Repo *RepositoryMeta `json:"repository"` diff --git a/services/convert/issue.go b/services/convert/issue.go index ecb3b93af1..e26412bcca 100644 --- a/services/convert/issue.go +++ b/services/convert/issue.go @@ -59,6 +59,8 @@ func toIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Iss Created: issue.CreatedUnix.AsTime(), Updated: issue.UpdatedUnix.AsTime(), PinOrder: util.Iif(issue.PinOrder == -1, 0, issue.PinOrder), // -1 means loaded with no pin order + + TimeEstimate: issue.TimeEstimate, } if issue.Repo != nil { diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 59da3ae9be..6dbc7e2a0e 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -25728,6 +25728,11 @@ "state": { "$ref": "#/definitions/StateType" }, + "time_estimate": { + "type": "integer", + "format": "int64", + "x-go-name": "TimeEstimate" + }, "title": { "type": "string", "x-go-name": "Title"