feat(contacts): distinct title/department values endpoint for autocomplete (PMS-583) #411
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-583-contact-field-suggestions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-583 (backend half)
The contact form's Title and Department stay free-text, but should suggest from the tenant's own past entries (server-sourced, not browser cache, not a fixed dropdown). This adds the endpoint that supplies those suggestions.
Endpoint
GET /api/v1/contacts/field-values?field=title|department&q=<substring>["..."]string list of the tenant's distinct non-empty values for the field.qis an optional case-insensitive substring filter; blank/absent means no filter.Safety
fieldis a closed enum (ContactSuggestField) mapping only to the whitelistedtitle/departmentcolumns, so the interpolated column name is never user-controlled. Theqterm is always a bound parameter.begin_with_tenant, like every other contacts query.No migration
The columns are already
VARCHAR(100)free text. Existing values just become the suggestion corpus. No schema change, no data movement.Companion
The frontend half (a reusable free-text-with-suggestions input wired into Title and Department) is a separate mokosh-apps PR.
🤖 Generated with Claude Code