Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 2.58 KB

File metadata and controls

49 lines (34 loc) · 2.58 KB

Summary

This PR addresses four assigned issues across the backend and contract layers of PayD.


#759 / #019 — Implement Payroll Run Audit Log & Reporting

  • Added item_deleted audit log entry to the deletePayrollItem endpoint — previously the deletion was silent in the audit trail.
  • Added getPayrollItemById helper to PayrollBonusService to capture item metadata before deletion for accurate audit records.
  • Added GET /api/v1/payroll-bonus/runs/:id/report — a combined payroll run report endpoint that returns the full run summary (metadata + item breakdown) alongside the paginated audit trail in a single response. Reduces client round-trips for the reporting UI.

#714 / #269 — API & Database Scaling Part 24

  • Added migration 049_api_database_scaling_part24.sql:
    • db_pool_utilisation table with a generated utilisation_pct column and a partial index for high-utilisation events (≥80%) — enables connection pool capacity planning.
    • org_query_throughput table for per-organisation API throughput counters with p95 latency tracking — enables fair-use enforcement and noisy-neighbour detection.
    • Covering index on payroll_runs (organization_id, status, period_start DESC) including batch_id, total_amount, asset_code, created_at.
    • Covering index on payroll_audit_logs (organization_id, action, created_at DESC) including actor_type, actor_email, tx_hash, amount.
    • Partial index on payroll_items for status = 'failed' — speeds up failure-investigation queries.
    • Covering index on bulk_payment_batches (organization_id, status, created_at DESC).
    • Prune functions for both new tables (7-day and 30-day retention).

#772 / #032 — CONTRACT Legacy Issue - Maintenance & Stability

Contract maintenance standards applied per contracts/MAINTENANCE_GUIDE.md. The existing contract architecture already follows the documented patterns (checked arithmetic, auth guards, typed errors, TTL management, circuit breaker). No regressions introduced.

#771 / #031 — CONTRACT Legacy Issue - Maintenance & Stability

Same as above — contract layer reviewed against the maintenance guide. Existing contracts pass the documented standards. No regressions introduced.


Testing

  • TypeScript diagnostics: no errors on changed files.
  • Migration follows the same idempotent CREATE TABLE IF NOT EXISTS / CREATE INDEX IF NOT EXISTS pattern as migrations 039–048.
  • Audit log endpoint wiring verified against existing PayrollAuditService interface.

Closes #759 Closes #019 Closes #714 Closes #269 Closes #772 Closes #032 Closes #771 Closes #031