Skip to content

Expose iteration ordinal number via APIs

euko requested to merge 349612-expose-iteration-number-via-apis into master

What does this MR do and why?

  • Exposes sequence attribute for Iteration model via APIs (GraphQL and REST API)

Why? We will use the sequence attribute when listing/displaying iterations #349612 (closed).

Although we will be using GraphQL on the frontend, the corresponding REST API endpoint is also updated per https://docs.gitlab.com/ee/architecture/blueprints/graphql_api/#design-graphql-interoperability-with-rest-api.

Sample graphql query:

query {
  group(fullPath: "gitlab-org") {
    iterations {
      nodes {
        id
        ordinalNumber
      }
    }
  }
}

Response:

{
  "data": {
    "group": {
      "iterations": {
        "nodes": [
          {
            "id": "gid://gitlab/Iteration/1",
            "ordinalNumber": 1
          },
          {
            "id": "gid://gitlab/Iteration/2",
            "ordinalNumber": 2
          },
          {
            "id": "gid://gitlab/Iteration/3",
          }
       }
    }
}

Sample REST API request:

Request URL: http://gdk.test:3000/api/v4/groups/107/iterations

Response:

[{"id":1,"iid":1,"ordinal_number":1,"group_id":107,"title":"Iteration 1","description":null,"state":3,"created_at":"2021-12-17T01:47:55.226Z","updated_at":"2021-12-17T01:47:55.226Z","start_date":"2021-12-01","due_date":"2021-12-07","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/1"},{"id":2,"iid":2,"ordinal_number":2,"group_id":107,"title":"Iteration 2","description":null,"state":3,"created_at":"2021-12-17T01:47:55.229Z","updated_at":"2021-12-17T01:47:55.229Z","start_date":"2021-12-08","due_date":"2021-12-14","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/2"},{"id":3,"iid":3,"ordinal_number":3,"group_id":107,"title":"Iteration 3","description":null,"state":2,"created_at":"2021-12-17T01:47:55.232Z","updated_at":"2021-12-17T01:47:55.232Z","start_date":"2021-12-15","due_date":"2021-12-21","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/3"},{"id":4,"iid":4,"ordinal_number":4,"group_id":107,"title":"Iteration 4","description":null,"state":1,"created_at":"2021-12-17T01:47:55.236Z","updated_at":"2021-12-17T01:47:55.236Z","start_date":"2021-12-22","due_date":"2021-12-28","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/4"},{"id":5,"iid":5,"ordinal_number":5,"group_id":107,"title":"Iteration 5","description":null,"state":1,"created_at":"2021-12-17T01:47:55.239Z","updated_at":"2021-12-17T01:47:55.239Z","start_date":"2021-12-29","due_date":"2022-01-04","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/5"},{"id":6,"iid":6,"ordinal_number":6,"group_id":107,"title":"Iteration 6","description":null,"state":1,"created_at":"2021-12-17T01:47:55.242Z","updated_at":"2021-12-17T01:47:55.242Z","start_date":"2022-01-05","due_date":"2022-01-11","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/6"},{"id":7,"iid":7,"ordinal_number":7,"group_id":107,"title":"Iteration 7","description":null,"state":1,"created_at":"2021-12-17T01:47:55.246Z","updated_at":"2021-12-17T01:47:55.246Z","start_date":"2022-01-12","due_date":"2022-01-18","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/7"},{"id":8,"iid":8,"ordinal_number":8,"group_id":107,"title":"Iteration 8","description":null,"state":1,"created_at":"2021-12-17T01:47:55.250Z","updated_at":"2021-12-17T01:47:55.250Z","start_date":"2022-01-19","due_date":"2022-01-25","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/8"},{"id":9,"iid":9,"ordinal_number":9,"group_id":107,"title":"Iteration 9","description":null,"state":1,"created_at":"2021-12-17T01:47:55.253Z","updated_at":"2021-12-17T01:47:55.253Z","start_date":"2022-01-26","due_date":"2022-02-01","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/9"},{"id":10,"iid":10,"ordinal_number":10,"group_id":107,"title":"Iteration 10","description":null,"state":1,"created_at":"2021-12-17T01:47:55.256Z","updated_at":"2021-12-17T01:47:55.256Z","start_date":"2022-02-02","due_date":"2022-02-08","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/10"},{"id":11,"iid":11,"ordinal_number":11,"group_id":107,"title":"Iteration 11","description":null,"state":1,"created_at":"2021-12-17T01:47:55.260Z","updated_at":"2021-12-17T01:47:55.260Z","start_date":"2022-02-09","due_date":"2022-02-15","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/11"},{"id":12,"iid":12,"ordinal_number":12,"group_id":107,"title":"Iteration 12","description":null,"state":1,"created_at":"2021-12-17T01:47:55.264Z","updated_at":"2021-12-17T01:47:55.264Z","start_date":"2022-02-16","due_date":"2022-02-22","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/12"},{"id":13,"iid":13,"ordinal_number":13,"group_id":107,"title":"Iteration 13","description":null,"state":1,"created_at":"2021-12-17T01:47:55.267Z","updated_at":"2021-12-17T01:47:55.267Z","start_date":"2022-02-23","due_date":"2022-03-01","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/13"},{"id":14,"iid":14,"ordinal_number":14,"group_id":107,"title":"Iteration 14","description":null,"state":1,"created_at":"2021-12-17T01:47:55.272Z","updated_at":"2021-12-17T01:47:55.272Z","start_date":"2022-03-02","due_date":"2022-03-08","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/14"},{"id":15,"iid":15,"ordinal_number":15,"group_id":107,"title":"Iteration 15","description":null,"state":1,"created_at":"2021-12-17T01:47:55.275Z","updated_at":"2021-12-17T01:47:55.275Z","start_date":"2022-03-09","due_date":"2022-03-15","web_url":"http://gdk.test:3000/groups/public-group-1/-/iterations/15"}]

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by euko

Merge request reports

Loading