Commit graph

8 commits

Author SHA1 Message Date
Cursor Agent
b58791aea4
refactor(core): finish RPC migration for budget, excel import, and docs
- Replace remaining budget.ts prepare() with fn_budget_replace and fn_project_update
- Migrate excel.ts findExisting, document store, assign, and catalogs to RPC
- Add 015-rpc-documents.sql for project/company/worker document metadata
- Document RPC envelope conventions in db/README.md
- Add http_errors_test and front api-response composables

Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
2026-09-04 00:01:57 +00:00
Cursor Agent
cff428d283
Refactor payroll_http and excel to use core RPC functions
- 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>
2026-09-03 23:57:36 +00:00
Cursor Agent
d2be5c5b76
Add payroll and import RPC changesets (013, 014)
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>
2026-09-03 23:52:42 +00:00
Cursor Agent
17936ce777
Add PostgreSQL RPC functions for workers domain
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>
2026-09-03 23:52:05 +00:00
Cursor Agent
7f2e84e47c
Add budget and badge RPC functions (changesets 011-012)
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>
2026-09-03 23:50:46 +00:00
Cursor Agent
a73090bd11
Add PostgreSQL RPC functions for projects domain (009-rpc-projects)
Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
2026-09-03 23:48:40 +00:00
Cursor Agent
02098d37b3
Add PostgreSQL RPC functions for companies CRUD
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>
2026-09-03 23:48:29 +00:00
Cursor Agent
b87b0205a8
db: migrar infraestructura de BD a Postgres (fase 0-1)
- 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>
2026-09-02 20:00:49 +00:00