#2748 REST API: Add feature to retrieve and filter issues over all repos
Merged by anar. Opened by anar.
anar/pagure IssuesApi  into  master

Download 2748.patch

Adds functionality to rest api to retrieve and filter issues over all of the repos. Using it with 'author' parameter addresses #2739.

Also adds 'order_by' parameter to 'search_issues()' which allows to order not only by time of creation, but also last update time.

There are no tests for the new feature yet, but right now I am looking for an opinion on the pull request. As soon as someone approves of the changes I will add tests.

I think I would prefer to mimick the behaviour of the UI and have an /user/<username/issues.

What do you think?

I looks good as a first glance but I'd also like if we could impose some filters to avoid dumping the entire DB page by page in this API endpoint.

(Note: this is now conflicting, I think due to the sorting by on search_issues())

I looks good as a first glance but I'd also like if we could impose some filters to avoid dumping the entire DB page by page in this API endpoint.
(Note: this is now conflicting, I think due to the sorting by on search_issues())

Yeah, I tried implementing it as flexible as possible, so that we can filter all of the issues based on any parameter, but you are right about dumping entire DP, that is not very smart.

The only argument why I am a bit hesitant about having /user//issues is the fact that filtering by author will be the one always enforced.
Don't you think there might be a scenario where we might be willing to filter issues over all repos based on something different than author (or assignee, or repo), like maybe based on 'since'? We could enforce it in a way so that the endpoint is only called with at least one parameter or the number of issues to be returned is less than something (but of course this requires discussion).

If there is not, then I will change the endpoint to /user//issues as you suggested.

Don't you think there might be a scenario where we might be willing to filter issues over all repos based on something different than author (or assignee, or repo), like maybe based on 'since'?

Until there is a valid use-case I think filtering by authors is the easier (as well as defaulting for example to only open issues). Since is really easy to abuse: since=1900-01-01 :)

Don't you think there might be a scenario where we might be willing to filter issues over all repos based on something different than author (or assignee, or repo), like maybe based on 'since'?

Until there is a valid use-case I think filtering by authors is the easier (as well as defaulting for example to only open issues). Since is really easy to abuse: since=1900-01-01 :)

Yeah, that makes sense :D. Then I will just make it as you suggested.

rebased onto 80c620f540dc28644f3e29c7248ad3b0b2ac55fd

Changed the commit

Looks good but we should add tests for this :)

(and rebase while at it :))

I'm thinking to cut a new release this week, do you think we could finish this PR?

I took your commit and added tests for it in https://pagure.io/pagure/pull-request/2793 (found a bug while doing so, so fixed it as well).

If you could review it, it would be most appreciated :)

Commit 4bf12090 fixes this pull-request

Pull-Request has been merged by anaradilovab@gmail.com

Metadata