Skip to content

insights: Add endpoint for relatedInsightsForRepo

Warren Gifford requested to merge insights/prototype-repo-insights into main

Created by: CristinaBirkel

Closes: https://github.com/sourcegraph/sourcegraph/issues/39123 Stacks on: https://github.com/sourcegraph/sourcegraph/pull/39249

Description

This adds the endpoint in for getting related insights that match repos.

The return type for the file/repo related insights should be the same, I believe, so I combined those into just one type that just has the insight id and title. We can also probably do some refactoring to reduce duplicate code, but since it's just a prototype it might not be worth the cleanup effort.

Test plan

Make sure you have a series in your database that has a select:repo query. Then run a graphql query like this:

query {
    relatedInsightsForRepo(input: {
        revision: "a84fde5e35eed41060acb6aa46b842af32133027",
        repo: "github.com/sourcegraph/sourcegraph"}) {
        viewId, title
    }
}

And verify that you get it back as expected.

Merge request reports

Loading