Skip to content

Add subscription_history to Namespace GraphQL Type

Sheldon Led requested to merge led/351280-gitlab-subscription-history-api-3 into master

What does this MR do and why?

Initial discussions in !159933 (closed)

This is the last of a series of MRs to implement https://gitlab.com/gitlab-org/gitlab/-/issues/355985 as part of https://gitlab.com/groups/gitlab-org/-/epics/14290

Proof of Concept (to see the whole picture): !159045 (closed)

In this MR we:

  1. Create Types::GitlabSubscriptions::SubscriptionHistoryType
  2. Add subscription_history to EE::Types::NamespaceType using the above type
  3. Add declarative_policy_subject to delegate the authorization to the namespace

MR Cadence

MR description
!159901 (merged) Add .by_namespace scope to GitlabSubscriptions::SubscriptionHistory
!159921 (merged) Add relation between Namespace and GitlabSubscriptions::SubscriptionHistory
!159933 (closed) 👈 you're here

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Switch to this MR's branch
  2. Open GraphQL Explorer: https://gdk.test:3443/-/graphql-explorer
  3. Run the following query:
    query getSubscriptionHistory(
            $fullPath: ID!
            $before: String
            $after: String
            $first: Int
            $last: Int
    ) {
      namespace(fullPath: $fullPath) {
        subscriptionHistory(after: $after, before: $before, first: $first, last: $last) {
          nodes {
            createdAt
            startDate
            endDate
            seats
            seatsInUse
            maxSeatsUsed
            changeType
          }
          pageInfo {
            hasNextPage
            hasPreviousPage
            startCursor
            endCursor
          }
       }
      }
    }
    
    ----- variables ----
    
    {
      "fullPath": "my-group-name",
      "first": 2
    }
Edited by Sheldon Led

Merge request reports

Loading