Page and filter an account's quotes in the database

Featurekamo-shared-library
Ya
5 Agosti 2026, 00:40 UTC
Mwandishi
Kamo
Ahadi ya
be9aecc

An account view needs every quote across all its leads. Loading them to render a page degrades every month the account is in use, and any total shown would only cover what was fetched — so paging, filtering and sorting all happen in SQL. The query is native because Quote holds only a soft leadId with no association to join through; it joins leads.uid = commerce_quotes.lead_id and scopes on leads.account_uid. Pulling the account's leads into an IN-list would not survive a large book of business. Every filter is a null-guarded predicate, so one query serves the unfiltered grid and any combination of filters rather than a method per permutation. Sort keys are allow-listed: the value reaches a native ORDER BY, so accepting an arbitrary field name from the client would be an injection point. The list projection also gains sentAt, acceptedAt, version and the option/line counts — an overview is read for "how long has this been out, did it land", which the previous fields could not answer.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei