diff options
author | 6543 <6543@obermui.de> | 2020-11-23 21:49:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-23 20:49:36 +0000 |
commit | f88a2eae9777e0be612647bc17227c1ca13616ba (patch) | |
tree | 78aad7908e3fa61e674610cb24c7f4d1b8ad9bc2 /models | |
parent | 78204a7a71eedbc099aff51abd88cb16f60d50a8 (diff) | |
download | gitea-f88a2eae9777e0be612647bc17227c1ca13616ba.tar.gz gitea-f88a2eae9777e0be612647bc17227c1ca13616ba.zip |
[API] Add more filters to issues search (#13514)
* Add time filter for issue search
* Add limit option for paggination
* Add Filter for: Created by User, Assigned to User, Mentioning User
* update swagger
* Add Tests for limit, before & since
Diffstat (limited to 'models')
-rw-r--r-- | models/issue.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go index ee75623f53..8c135faa8d 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1100,6 +1100,8 @@ type IssuesOptions struct { ExcludedLabelNames []string SortType string IssueIDs []int64 + UpdatedAfterUnix int64 + UpdatedBeforeUnix int64 // prioritize issues from this repo PriorityRepoID int64 } @@ -1178,6 +1180,13 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) { sess.In("issue.milestone_id", opts.MilestoneIDs) } + if opts.UpdatedAfterUnix != 0 { + sess.And(builder.Gte{"issue.updated_unix": opts.UpdatedAfterUnix}) + } + if opts.UpdatedBeforeUnix != 0 { + sess.And(builder.Lte{"issue.updated_unix": opts.UpdatedBeforeUnix}) + } + if opts.ProjectID > 0 { sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id"). And("project_issue.project_id=?", opts.ProjectID) |