Skip to content

fix(api): provider-agnostic org search predicate - #95

Merged
brinehart merged 1 commit into
epic/should-fixfrom
fix/should-fix-57
Nov 2, 2026
Merged

brinehart merged 1 commit into
epic/should-fixfrom
fix/should-fix-57

Conversation

@brinehart

Copy link
Copy Markdown
Collaborator

Closes #57

Summary

Replaces the untranslatable Contains(..., StringComparison) overload in OrganizationsService.GetOrganizations with the same provider-agnostic, case-insensitive predicate the Clients search uses after #50:

if (!string.IsNullOrEmpty(request.SearchTerm))
{
    var searchTerm = request.SearchTerm.ToLower();
    predicate.And(o => o.Name.ToLower().Contains(searchTerm));
}
  • ToLower().Contains(...) translates on both Npgsql (SQL LOWER()/strpos) and the EF Core InMemory provider, so the filter is correct on PostgreSQL and unit-testable. EF.Functions.ILike is deliberately not used (Npgsql-only, untranslatable under InMemory).
  • Guard changed from is not null to !string.IsNullOrEmpty (matches Clients), so an empty term adds no filter.

Tests

Adds InMemory xUnit tests for GetOrganizations search: case-insensitive match, substring match, no-match-empty, and null/empty term returns all.

Gate

Local ./scripts/check.sh green: nx format:check, nx affected -t lint test build, and dotnet test core/csharp/MicroZen.Core.sln — 65 passed / 0 failed.

Replace the untranslatable Contains(..., StringComparison) overload in
OrganizationsService.GetOrganizations with the same ToLower().Contains()
predicate the Clients search uses (#50), guarded by !IsNullOrEmpty. This
translates on both Npgsql (LOWER()/strpos) and the EF Core InMemory provider,
so the filter is correct on PostgreSQL and unit-testable.

Add InMemory xUnit tests for org search: case-insensitive match, substring
match, no-match empty, and null/empty term returns all.

Closes #57
@nx-cloud

nx-cloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 59e67a0

Command Status Duration Result
nx affected -t lint test build ✅ Succeeded 38s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-02 05:01:23 UTC

@brinehart

Copy link
Copy Markdown
Collaborator Author

ALL-CLEAR — Org search predicate now uses the provider-agnostic !string.IsNullOrEmpty + o.Name.ToLower().Contains(searchTerm) shape matching the Clients #50 fix exactly (no EF.Functions.ILike); 4 InMemory tests (case-insensitive, substring, no-match, null/empty-returns-all) cover it; CI green.

@brinehart
brinehart merged commit c1af58b into epic/should-fix Nov 2, 2026
2 checks passed
brinehart added a commit that referenced this pull request Nov 2, 2026
Replace the untranslatable Contains(..., StringComparison) overload in
OrganizationsService.GetOrganizations with the same ToLower().Contains()
predicate the Clients search uses (#50), guarded by !IsNullOrEmpty. This
translates on both Npgsql (LOWER()/strpos) and the EF Core InMemory provider,
so the filter is correct on PostgreSQL and unit-testable.

Add InMemory xUnit tests for org search: case-insensitive match, substring
match, no-match empty, and null/empty term returns all.

Closes #57

Co-authored-by: brinehart <ben.rinehart@avifoodsystems.comc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant