2.1 KiB
Phase 10 — Search results aren't de-duplicated, and trust info is hardcoded
Blocker: blockers.md § "Search." Depends on: nothing to start; do together with 09-nurse-verification-badge.md — same root cause on the badge half.
10a. Not de-duplicated — architectural, not accidental
NurseSearchIndex.cs:7-11 documents itself as
"one flat row per (bookable variant × covered service area)." SqlNurseSearch.SearchAsync:20-59 filters/
sorts/paginates the raw rows with no GroupBy(NurseId) — total is a row count, so pagination itself is
row-counted. This is a stated, accepted fact of the contract client-side too
(search/types.ts:14-15), not previously flagged as a bug.
Fix: move the dedup into SqlNurseSearch.SearchAsync itself (must be SQL-layer, since page size needs to
be nurse-counted, not row-counted, for correct pagination) — group by NurseId inside the existing filter
chain, pick one representative row per nurse (e.g. lowest matching price, keep the existing rating sort),
count/paginate over the grouped set. NurseSearchResultDto needs a shape change to represent "one card, N
matching services."
10b. Trust info on the result card is hardcoded, and an unverified nurse's profile can show as verified
Both NurseResultCard.tsx:87 and search/nurse/[nurseId]/page.tsx:173 hardcode state="verified" instead of
deriving it from real data — the exact same bug as phase 09's "badge doesn't reflect reality," just a
different call site. verification/types.ts:328-330's publicBadgeState() helper already exists for this
and isn't used by either. Fix both call sites in the same change as phase 09's verification-badge fix.
Flag, don't guess: whether an anonymous customer should be able to view an unverified nurse's profile at
all (vs. a clean 404) isn't stated anywhere in mvp//archive/product/. Note this is a display bug, not
a money-safety bypass — CreateBookingRequestCommand.Handler.cs:56-57 independently gates actual booking
creation on IsVerified && IsAcceptingBookings, so an unverified nurse reached by direct link can be shown
misleadingly but not actually booked.