Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(issueVariant): add filter by secondaryName in baseResolver #374

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/api/graphql/graph/baseResolver/issue_variant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions internal/database/mariadb/issue_variant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading