Skip to content

Introduce project.vulnerabilityArchives GraphQL field

What does this MR do and why?

This MR introduces a new GrapqhQL field for the projectType named vulnerabilityArchives. The whole feature is still a work in progress, therefore, there is a new flag that controls the behavior of the resolver.

Even though the API is controlled by a feature flag, I added the changelog entry for the sake of transparency as we are updating the API docs.

How to test this

First of all, we need to create archive records in the database, like so;

# in rails console
project = Project.find($id_of_the_project) # Use a project ID from your database
dates = (3.years.ago.to_date...Date.today).map(&:beginning_of_month).uniq

dates.each { |date| project.vulnerability_archives.create!(date: date, archived_records_count: (rand * 100).to_i) }

Enable the feature flag;

# in rails console

Feature.enable(:vulnerability_archival)

Then we can query the archive records, like so;

query getArchives($project_id: ID!) {
  project(fullPath: $project_id) {
    vulnerabilityArchives {
      date
      archivedRecordsCount
    }
  }
}
Edited by Mehmet Emin INAC

Merge request reports

Loading