refactor: pass retired/expired as booleans and couple SQL key with its params
Drops the boolToSqlParam helper and the LOWER(\$N::text) = 'true'/'false'
SQL gymnastics. ajv already coerces query strings to booleans from the
type:boolean schema, and node-postgres serializes booleans into the wire
format Postgres expects — so the parameters can flow through end-to-end
without a string detour. The boolean SQL is also shorter:
(NOT c.registered) = \$5::boolean -- retired filter
expired_predicate = \$6::boolean -- expired filter
The ::boolean annotation is still needed for the same parameter-type
inference reason as before.
Route handler now selects the SQL key and its parameter array together
(single { key, params } literal per branch) so the two can't drift
independently when one is edited.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>