diff --git a/internal/api/graphql/graph/baseResolver/issue_variant.go b/internal/api/graphql/graph/baseResolver/issue_variant.go index 27ac6af..aed2c74 100644 --- a/internal/api/graphql/graph/baseResolver/issue_variant.go +++ b/internal/api/graphql/graph/baseResolver/issue_variant.go @@ -92,6 +92,7 @@ func IssueVariantBaseResolver(app app.Heureka, ctx context.Context, filter *mode Paginated: entity.Paginated{First: first, After: afterId}, IssueId: issueId, IssueRepositoryId: irId, + SecondaryName: filter.SecondaryName, } opt := GetListOptions(requestedFields) diff --git a/internal/database/mariadb/issue_variant_test.go b/internal/database/mariadb/issue_variant_test.go index 11ea6ca..3e62241 100644 --- a/internal/database/mariadb/issue_variant_test.go +++ b/internal/database/mariadb/issue_variant_test.go @@ -309,6 +309,27 @@ var _ = Describe("IssueVariant - ", Label("database", "IssueVariant"), func() { } }) }) + It("can filter by a secondary name", func() { + iv := seedCollection.IssueVariantRows[rand.Intn(len(seedCollection.IssueVariantRows))] + + filter := &entity.IssueVariantFilter{ + SecondaryName: []*string{&iv.SecondaryName.String}, + } + + entries, err := db.GetIssueVariants(filter) + + By("throwing no error", func() { + Expect(err).To(BeNil()) + }) + + By("returning expected number of results", func() { + Expect(entries).To(HaveLen(1)) + }) + + By("returning expected elements", func() { + Expect(entries[0].SecondaryName).To(BeEquivalentTo(iv.SecondaryName.String)) + }) + }) }) Context("and using Pagination", func() { DescribeTable("can correctly paginate", func(pageSize int) {