Skip to content

Added updated params to milestone API

What does this MR do and why?

Updated the REST API to include updated_before and updated_after on both group and project level milestone APIs.

How to set up and validate locally

  • Generate an API token in your user preferences
  • perform request like the following:
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/projects/6/milestones?updated_before=2014-02-17T09%3A24%3A18Z"

curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/projects/6/milestones?updated_after=2023-02-14T09%3A24%3A18Z"

curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/groups/6/milestones?updated_before=2023-02-14T09%3A24%3A18Z"

curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/groups/6/milestones?updated_after=2023-02-14T09%3A24%3A18Z"

Database review

Project level milestones updated before date

https://console.postgres.ai/shared/340640ef-cd20-4f42-8c90-8d83bc274a30
SELECT 
  "milestones".* 
FROM 
  (
    (
      SELECT 
        "milestones".* 
      FROM 
        "milestones" 
      WHERE 
        "milestones"."project_id" = 13083
    ) 
    UNION ALL 
      (
        SELECT 
          "milestones".* 
        FROM 
          "milestones" 
        WHERE 
          1 = 0
      )
  ) milestones 
WHERE 
  "milestones"."updated_at" <= '2021-02-17 09:24:18' 
ORDER BY 
  "milestones"."due_date" ASC NULLS LAST, 
  "milestones"."id" DESC 
LIMIT 
  20 OFFSET 0

Project level milestones updated after date

https://console.postgres.ai/shared/33699344-731c-4f6c-931b-8b8034bca1d5
SELECT 
  "milestones".* 
FROM 
  (
    (
      SELECT 
        "milestones".* 
      FROM 
        "milestones" 
      WHERE 
        "milestones"."project_id" = 13083
    ) 
    UNION ALL 
      (
        SELECT 
          "milestones".* 
        FROM 
          "milestones" 
        WHERE 
          1 = 0
      )
  ) milestones 
WHERE 
  "milestones"."updated_at" >= '2021-02-17 09:24:18' 
ORDER BY 
  "milestones"."due_date" ASC NULLS LAST, 
  "milestones"."id" DESC 
LIMIT 
  20 OFFSET 0

Group level milestones updated before

https://console.postgres.ai/shared/cf680f6c-9744-4f5d-a80e-7bdf322a4f3d
SELECT 
  "milestones".* 
FROM 
  (
    (
      SELECT 
        "milestones".* 
      FROM 
        "milestones" 
      WHERE 
        1 = 0
    ) 
    UNION ALL 
      (
        SELECT 
          "milestones".* 
        FROM 
          "milestones" 
        WHERE 
          "milestones"."group_id" = 9970
      )
  ) milestones 
WHERE 
  "milestones"."updated_at" <= '2021-02-17 09:24:18' 
ORDER BY 
  "milestones"."due_date" ASC NULLS LAST, 
  "milestones"."id" DESC 
LIMIT 
  20 OFFSET 0

Group level milestones updated after

https://console.postgres.ai/shared/1e1c64a1-bd51-4952-bd82-9019600a4494
SELECT 
  "milestones".* 
FROM 
  (
    (
      SELECT 
        "milestones".* 
      FROM 
        "milestones" 
      WHERE 
        1 = 0
    ) 
    UNION ALL 
      (
        SELECT 
          "milestones".* 
        FROM 
          "milestones" 
        WHERE 
          "milestones"."group_id" = 9970
      )
  ) milestones 
WHERE 
  "milestones"."updated_at" >= '2021-02-17 09:24:18' 
ORDER BY 
  "milestones"."due_date" ASC NULLS LAST, 
  "milestones"."id" DESC 
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.

Related to #378662 (closed)

Edited by Mario Celi

Merge request reports

Loading