Refactor packages finder to use package class

What does this MR do and why?

Refactor packages finder to use package class.

References

Foundation: Prepare application code to read fr... (#548761 - closed)

Screenshots or screen recordings

No.

How to set up and validate locally

REST API

  1. Enable the feature flag

    Feature.enable(:packages_refactor_packages_finder)
  2. Create a package with a couple of versions.

    def fixture_file_upload(*args, **kwargs)
      Rack::Test::UploadedFile.new(*args, **kwargs)
    end
    p = FactoryBot.create(:npm_package, version: '1.0.0')
    FactoryBot.create(:npm_package, version: '2.0.0', name: p.name, project: p.project)
    FactoryBot.create(:maven_package, project: p.project)
  3. Create HTTP request to fetch the package's details docs.

    $ curl --header "PRIVATE-TOKEN: <your_access_token>"  "http://gdk.test:3000/api/v4/projects/{p.project_id}/packages?package_type=npm"

    Check that only packages of provided type are returned.

GraphQL API

  1. Execute the steps 1. and 2. from the REST API section if you haven't already.

  2. Visit graphql explorer and execute the next query http://gdk.test:3000/-/graphql-explorer

    query {
      project(fullPath: "{p.project.full_path}"){
        id
        name
        packages(packageType: NPM) {
          nodes {
            id
            name
          }
        }
      }
    }

    Check that only packages of provided type are returned.

MR acceptance checklist

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

Related to #548761 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading