aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYarden Shoham <hrsi88@gmail.com>2022-11-15 11:33:52 +0200
committerGitHub <noreply@github.com>2022-11-15 11:33:52 +0200
commit6c8ff32511f4295fa381a0144a7200e4eff273d6 (patch)
tree0d39fcde7d58c9beaff639d98692beb06e8cda1b
parentc772934ff623b3a76efbe306f597695330a71287 (diff)
downloadgitea-6c8ff32511f4295fa381a0144a7200e4eff273d6.tar.gz
gitea-6c8ff32511f4295fa381a0144a7200e4eff273d6.zip
Add `updated_at` field to PullReview API object (#21812)
* Closes #19997 Adds an `updated_at` time field to the `PullReview` API object to specify when the pull request review's state changed. Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
-rw-r--r--modules/convert/pull_review.go1
-rw-r--r--modules/structs/pull_review.go2
-rw-r--r--templates/swagger/v1_json.tmpl5
3 files changed, 8 insertions, 0 deletions
diff --git a/modules/convert/pull_review.go b/modules/convert/pull_review.go
index 93ce208224..e8a543fea9 100644
--- a/modules/convert/pull_review.go
+++ b/modules/convert/pull_review.go
@@ -39,6 +39,7 @@ func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.
Dismissed: r.Dismissed,
CodeCommentsCount: r.GetCodeCommentsCount(),
Submitted: r.CreatedUnix.AsTime(),
+ Updated: r.UpdatedUnix.AsTime(),
HTMLURL: r.HTMLURL(),
HTMLPullURL: r.Issue.HTMLURL(),
}
diff --git a/modules/structs/pull_review.go b/modules/structs/pull_review.go
index 7c9360a0c2..ca2af48657 100644
--- a/modules/structs/pull_review.go
+++ b/modules/structs/pull_review.go
@@ -40,6 +40,8 @@ type PullReview struct {
CodeCommentsCount int `json:"comments_count"`
// swagger:strfmt date-time
Submitted time.Time `json:"submitted_at"`
+ // swagger:strfmt date-time
+ Updated time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
HTMLPullURL string `json:"pull_request_url"`
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index 229e219064..fe3185ea77 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -17891,6 +17891,11 @@
"team": {
"$ref": "#/definitions/Team"
},
+ "updated_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "Updated"
+ },
"user": {
"$ref": "#/definitions/User"
}