- Pass JS objects to postgres jsonb params in callCoreFn (not JSON.stringify)
- Use splitStatements:false on RPC function changesets for Liquibase
- Fix needs_badge default in _worker_normalize when field is omitted
- Add scripts/crud-smoke-test.sh for API CRUD verification
- Fix findExistingWorker return type in main.ts
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
- Replace db.prepare() in payroll_http with callCoreFn for attendance,
loans, loan receipts, and legacy payroll period routes
- Use respondRpc/respondApiError for standardized HTTP responses
- Add fn_loan_list/get, fn_loan_payment_get, and fn_payroll_period_* RPCs
to 013-rpc-payroll.sql with grants
- Refactor excel storeDocument to fn_worker_document_store (S3 stays in TS)
- Refactor importExcel and upsertWorker to fn_workers_import_batch
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
Port key payroll operations from api/payroll.ts to plpgsql RPCs with
round_money helper, internal recalc/ensure logic, and core.rpc_* envelope.
Add batch worker import and post-S3 document metadata store RPCs with
Spanish validation messages and panels_core_app grants.
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
Port worker list/get/create/update, pipeline, assign/unassign, find-existing,
refresh-pipeline, and checklist-raw from api/main.ts and api/db.ts with
Spanish RPC envelopes, IMSS flag helpers, and panels_core_app grants.
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
Implement core.fn_budget_* for list, chapter/item CRUD, and atomic
replace import; core.fn_badge_job_* for create, list, get, and delivery
tracking. All functions use SECURITY INVOKER, rpc envelope helpers, Spanish
messages, and GRANT EXECUTE to panels_core_app.
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
Implement fn_company_list, fn_company_get, fn_company_get_by_code,
fn_company_create, fn_company_update, and fn_next_company_code with
shared validation helpers mirroring api/companies.ts logic. Uses RPC
envelope helpers from 006-rpc-infra.sql with detailed Spanish error
messages and GRANT EXECUTE for panels_core_app.
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
- Fase 0: scripts de aprovisionamiento (db/provision/) para roles, dos
bases de datos separadas (panels_platform / panels_product con
esquemas iam+core) y ACLs de Redis por modulo, con verificacion
automatizada de aislamiento (verify-isolation.sh) y setup local
reproducible (dev-local.sh).
- Fase 1: changelogs de Liquibase reescritos para Postgres
(db/platform, db/iam, db/core reemplazan db/app + los changesets
SQLite de platform). Baseline como estado final (no replay literal),
tipos traducidos (IDENTITY, TIMESTAMPTZ/DATE, NUMERIC, BOOLEAN,
CITEXT), contexts dev vs. schema/catalogos, RLS por tenant_id como
defensa en profundidad, uploaded_by/created_by como snapshot
desnormalizado (sin FK hacia iam).
- Migraciones ya no corren en el arranque de la API: paso explicito de
deploy via db/update.sh con credenciales _owner.
Verificado end-to-end contra Postgres 16 + Redis local.
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>