forked from forgejo/forgejo
[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
This commit is contained in:
parent
78204a7a71
commit
f88a2eae97
4 changed files with 130 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue