Add updated_before and updated_after filters to iterations API
What does this MR do and why?
REST API now allows filtering results by the date they were last updated at
How to set up and validate locally
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/projects/6/iterations?updated_before=2014-02-17T09%3A24%3A18Z"
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/projects/6/iterations?updated_after=2023-02-14T09%3A24%3A18Z"
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/groups/6/iterations?updated_before=2023-02-14T09%3A24%3A18Z"
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/groups/6/iterations?updated_after=2023-02-14T09%3A24%3A18Z"
Database review
Both project and group level requests will generate the same group level query. Project level requests will simply get iterations from the parent group the project belongs to.
Group level updated before
https://console.postgres.ai/shared/fb454d3e-f3d0-4ed5-a692-0354abcd769e
```sql SELECT "sprints".* FROM "sprints" WHERE "sprints"."group_id" IN ( SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 9970 ) AND "sprints"."updated_at" <= '2022-12-17 09:24:18' ORDER BY "sprints"."due_date" ASC, "sprints"."title" ASC, "sprints"."id" ASC LIMIT 20 OFFSET 0 ```Group level updated after
https://console.postgres.ai/shared/2e0b106e-811e-418d-8a2c-22668df048a7
```sql SELECT "sprints".* FROM "sprints" WHERE "sprints"."group_id" IN ( SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = 9970 ) AND "sprints"."updated_at" >= '2022-12-17 09:24:18' ORDER BY "sprints"."due_date" ASC, "sprints"."title" ASC, "sprints"."id" ASC LIMIT 20 OFFSET 0 ```MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #378662 (closed)
Edited by Mario Celi