feat: add MFA/TOTP auth, PII encryption, agents/leads/inquiries modules, and comprehensive tests

- Add TOTP-based MFA with setup, verify, disable, backup codes, and challenge flow
- Add PII field encryption middleware with AES-256-GCM and deterministic search hashes
- Add agents, inquiries, and leads domain modules with entities, events, value objects
- Add web dashboard pages for inquiries and leads with detail dialogs
- Add 30+ component tests (valuation, charts, listings, search, providers, UI)
- Add Prisma migrations for encryption hash columns and MFA TOTP support
- Fix all ESLint errors (unused imports, duplicate imports, lint auto-fixes)
- Update dependencies and lock file
- Clean up obsolete exploration/QA docs, add audit documentation

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-11 23:43:20 +07:00
parent 9e2bf9a4b5
commit 1fbe2f4e73
131 changed files with 11436 additions and 2595 deletions

View File

@@ -2,7 +2,7 @@
**Last Updated:** 2026-04-11
**Project:** Goodgo Platform AI
**Status:** MVP Complete — Phase 7 (Post-MVP Improvements) Wave 8 In Progress
**Status:** MVP Complete — Phase 7 (Post-MVP Improvements) Wave 11 In Progress
---
@@ -236,10 +236,10 @@
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ------ | ------------------------- |
| [TEC-1774](/TEC/issues/TEC-1774) | Fix 2 TypeScript compile errors blocking CI typecheck | Critical | todo | Senior Backend Engineer |
| [TEC-1735](/TEC/issues/TEC-1735) | Commit 105 uncommitted file changes | Critical | todo | Senior Backend Engineer |
| [TEC-1775](/TEC/issues/TEC-1775) | Add unit tests for MCP, Inquiries, and Leads modules | High | todo | QA Engineer |
| [TEC-1736](/TEC/issues/TEC-1736) | Add error handling to remaining backend CQRS handlers | High | todo | Senior Backend Engineer |
| [TEC-1774](/TEC/issues/TEC-1774) | Fix 2 TypeScript compile errors blocking CI typecheck | Critical | done | Senior Backend Engineer |
| [TEC-1735](/TEC/issues/TEC-1735) | Commit 105 uncommitted file changes | Critical | done | Senior Backend Engineer |
| [TEC-1775](/TEC/issues/TEC-1775) | Add unit tests for MCP, Inquiries, and Leads modules | High | done | QA Engineer |
| [TEC-1736](/TEC/issues/TEC-1736) | Add error handling to remaining backend CQRS handlers | High | done | Senior Backend Engineer |
#### Wave 9B — Medium Priority (P2)
@@ -247,10 +247,10 @@
| -------------------------------- | ------------------------------------------------------------ | -------- | ------ | ------------------------- |
| [TEC-1776](/TEC/issues/TEC-1776) | Refactor 3 oversized files exceeding 220 LOC | Medium | todo | Senior Backend Engineer |
| [TEC-1777](/TEC/issues/TEC-1777) | Implement agent quality score auto-calculation cron | Medium | todo | Senior Backend Engineer |
| [TEC-1778](/TEC/issues/TEC-1778) | Add staging environment auto-deploy pipeline | Medium | todo | DevOps Engineer |
| [TEC-1778](/TEC/issues/TEC-1778) | Add staging environment auto-deploy pipeline | Medium | done | DevOps Engineer |
| [TEC-1740](/TEC/issues/TEC-1740) | DTO validation hardening | Medium | todo | Senior Backend Engineer |
| [TEC-1699](/TEC/issues/TEC-1699) | Implement saved search email alerts | Medium | todo | Senior Backend Engineer |
| [TEC-1708](/TEC/issues/TEC-1708) | Add lightbox image gallery to property detail | Medium | blocked| Senior Frontend Engineer |
| [TEC-1699](/TEC/issues/TEC-1699) | Implement saved search email alerts | Medium | done | Senior Backend Engineer |
| [TEC-1708](/TEC/issues/TEC-1708) | Add lightbox image gallery to property detail | Medium | done | Senior Frontend Engineer |
---
@@ -270,7 +270,9 @@
| Phase 7W7 | 9 | 0 | 0 | 0 | 9 |
| Phase 7W8 | 11 | 6 | 0 | 0 | 5 |
| Phase 7W9 | 10 | 0 | 0 | 1 | 9 |
| **Total** | **115** | **77**| **4** | **2** | **32** |
| Phase 7W10 | 12 | 8 | 1 | 0 | 3 |
| Phase 7W11 | 9 | 0 | 2 | 1 | 6 |
| **Total** | **136** | **85**| **7** | **2** | **42** |
### Wave 10 — CEO Audit (2026-04-11) — Automated Routine
@@ -278,24 +280,80 @@
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ------ | ------------------------- |
| [TEC-1839](/TEC/issues/TEC-1839) | Commit 105 uncommitted files + Fix 2 TS compile errors | Critical | todo | Senior Backend Engineer |
| [TEC-1839](/TEC/issues/TEC-1839) | Commit 105 uncommitted files + Fix 2 TS compile errors | Critical | done | Senior Backend Engineer |
#### Wave 10B — High Priority (P1)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ------ | ------------------------- |
| [TEC-1840](/TEC/issues/TEC-1840) | Add unit tests for Agents, Inquiries, Leads, Reviews modules | High | todo | QA Engineer |
| [TEC-1841](/TEC/issues/TEC-1841) | Fix login endpoint returning 500 instead of 401 | High | todo | Senior Backend Engineer |
| [TEC-1736](/TEC/issues/TEC-1736) | Add error handling to remaining CQRS handlers | High | in_progress | Senior Backend Engineer |
| [TEC-1840](/TEC/issues/TEC-1840) | Add unit tests for Agents, Inquiries, Leads, Reviews modules | High | done | QA Engineer |
| [TEC-1841](/TEC/issues/TEC-1841) | Fix login endpoint returning 500 instead of 401 | High | done | Senior Backend Engineer |
| [TEC-1736](/TEC/issues/TEC-1736) | Add error handling to remaining CQRS handlers | High | done | Senior Backend Engineer |
| [TEC-1846](/TEC/issues/TEC-1846) | Build Inquiry & Lead Management UI for Agent Portal | High | done | Senior Frontend Engineer |
| [TEC-1848](/TEC/issues/TEC-1848) | Create production runbook, alerting rules & DR validation | High | done | SRE Engineer |
| [TEC-1849](/TEC/issues/TEC-1849) | Expand K6 load test coverage: search, admin, MCP endpoints | High | done | SRE Engineer |
#### Wave 10C — Medium Priority (P2)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ----------- | ------------------------- |
| [TEC-1842](/TEC/issues/TEC-1842) | Refactor Agents/Inquiries/Leads/Reviews to full DDD | Medium | in_progress | Architect |
| [TEC-1777](/TEC/issues/TEC-1777) | Implement agent quality score auto-calculation cron | Medium | todo | Senior Backend Engineer |
| [TEC-1778](/TEC/issues/TEC-1778) | Add staging environment auto-deploy pipeline | Medium | done | DevOps Engineer |
| [TEC-1699](/TEC/issues/TEC-1699) | Implement saved search email alerts | Medium | done | Senior Backend Engineer |
| [TEC-1708](/TEC/issues/TEC-1708) | Add lightbox image gallery to property detail page | Medium | done | Senior Frontend Engineer |
### Wave 11 — CEO Audit (2026-04-11) — Automated Routine
#### Wave 11A — Critical (P0)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ------ | ------------------------- |
| [TEC-1842](/TEC/issues/TEC-1842) | Refactor Agents/Inquiries/Leads/Reviews to full DDD | Medium | todo | Architect |
| [TEC-1777](/TEC/issues/TEC-1777) | Implement agent quality score auto-calculation cron | Medium | todo | Senior Backend Engineer |
| [TEC-1778](/TEC/issues/TEC-1778) | Add staging environment auto-deploy pipeline | Medium | todo | DevOps Engineer |
| [TEC-1699](/TEC/issues/TEC-1699) | Implement saved search email alerts | Medium | todo | Senior Backend Engineer |
| [TEC-1876](/TEC/issues/TEC-1876) | Fix 9 ESLint errors — consistent-type-imports + unused vars | Critical | todo | Senior Backend Engineer |
| [TEC-1877](/TEC/issues/TEC-1877) | Commit 59 uncommitted files (17 modified + 42 untracked) | Critical | todo | Senior Backend Engineer |
#### Wave 11B — High Priority (P1)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ------- | ------------------------- |
| [TEC-1878](/TEC/issues/TEC-1878) | Investigate and unblock E2E test environment (TEC-1652) | High | todo | DevOps Engineer |
| [TEC-1547](/TEC/issues/TEC-1547) | E2E Integration Verification — Full MVP Happy Path | High | in_progress | QA Engineer |
| [TEC-1847](/TEC/issues/TEC-1847) | Add React component tests (RTL) for critical components | Medium | todo | QA Engineer |
#### Wave 11C — Medium Priority (P2) — Carryover
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ------------------------------------------------------------ | -------- | ----------- | ------------------------- |
| [TEC-1842](/TEC/issues/TEC-1842) | Refactor Agents/Inquiries/Leads/Reviews to full DDD | Medium | in_progress | Architect |
| [TEC-1777](/TEC/issues/TEC-1777) | Implement agent quality score auto-calculation cron | Medium | todo | Senior Backend Engineer |
| [TEC-1776](/TEC/issues/TEC-1776) | Refactor 3 oversized files exceeding 220 LOC | Medium | todo | Senior Backend Engineer |
| [TEC-1740](/TEC/issues/TEC-1740) | DTO validation hardening — phone, password, email | Medium | todo | Senior Backend Engineer |
### Wave 11D — CEO Full Audit Subtasks (2026-04-11)
Parent task: [TEC-1882](/TEC/issues/TEC-1882) — GoodGo Platform AI CEO Audit
#### Wave 11D-Critical — Fix Build Pipeline (P0)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ---------------------------------------------------------------- | -------- | ------ | ------------------------- |
| [TEC-1888](/TEC/issues/TEC-1888) | Fix 725 ESLint errors and TypeScript compilation errors in web | Critical | todo | Senior Frontend Engineer |
| [TEC-1889](/TEC/issues/TEC-1889) | Fix 27 failing rate limit guard unit tests in shared module | Critical | todo | Senior Backend Engineer |
#### Wave 12 — Module Completion (P1)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ---------------------------------------------------------------- | -------- | ------ | ------------------------- |
| [TEC-1890](/TEC/issues/TEC-1890) | Complete 3 incomplete API modules (health, metrics, MCP) | High | todo | Senior Backend Engineer |
| [TEC-1891](/TEC/issues/TEC-1891) | Implement production MCP servers (search, analytics, valuation) | High | todo | Senior Backend Engineer |
#### Wave 13 — Quality & Security (P1-P2)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ---------------------------------------------------------------- | -------- | ------ | ------------------------- |
| [TEC-1892](/TEC/issues/TEC-1892) | Expand web component unit tests to 50% coverage | High | todo | Senior Frontend Engineer |
| [TEC-1893](/TEC/issues/TEC-1893) | Implement field-level encryption for PII and payment data | High | todo | Security Engineer |
| [TEC-1894](/TEC/issues/TEC-1894) | Add TOTP-based MFA support for agent and admin accounts | Medium | todo | Security Engineer |
---
@@ -315,9 +373,57 @@
| Phase 7W7 | 9 | 0 | 0 | 0 | 9 |
| Phase 7W8 | 11 | 6 | 0 | 0 | 5 |
| Phase 7W9 | 10 | 0 | 0 | 1 | 9 |
| Phase 7W10 | 8 | 0 | 1 | 0 | 7 |
| **Total** | **123** | **77**| **5** | **2** | **39** |
| Phase 7W10 | 12 | 8 | 1 | 0 | 3 |
| Phase 7W11 | 16 | 0 | 2 | 1 | 13 |
| Phase 7W12 | 2 | 0 | 0 | 0 | 2 |
| Phase 7W13 | 3 | 0 | 0 | 0 | 3 |
| **Total** | **148** | **85**| **7** | **3** | **53** |
### Wave 12 — CEO Audit (2026-04-11) — CI Pipeline Fix
Parent task: [TEC-1895](/TEC/issues/TEC-1895) — GoodGo Platform AI
#### Wave 12A — Fix CI Pipeline (P0)
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ---------------------------------------------------------------- | -------- | ------ | ------------------------- |
| [TEC-1898](/TEC/issues/TEC-1898) | Fix Prisma 7 migration: replace $use() middleware with $extends | Critical | todo | Senior Backend Engineer |
| [TEC-1899](/TEC/issues/TEC-1899) | Fix 31 failing unit tests (rate-limit guards + auth repo) | Critical | todo | QA Engineer |
| [TEC-1900](/TEC/issues/TEC-1900) | Fix 4 ESLint errors and commit 91 uncommitted files | Critical | todo | Senior Backend Engineer |
#### Wave 12B — Bug Fixes & Feature Completion (P1) — Carryover
| Issue | Title | Priority | Status | Assignee |
| -------------------------------- | ---------------------------------------------------------------- | -------- | ----------- | ------------------------- |
| [TEC-1649](/TEC/issues/TEC-1649) | Fix login endpoint returning 500 instead of 401 | High | in_progress | Senior Backend Engineer |
| [TEC-1657](/TEC/issues/TEC-1657) | Add audit logging for admin actions | High | todo | Senior Backend Engineer |
| [TEC-1878](/TEC/issues/TEC-1878) | Investigate and unblock E2E test environment | High | todo | DevOps Engineer |
| [TEC-1847](/TEC/issues/TEC-1847) | Add React component tests (RTL) for critical components | Medium | todo | QA Engineer |
---
*Last updated by CEO audit — 2026-04-11 (Wave 10 added — TEC-1839 through TEC-1842, automated routine audit)*
## Summary
| Phase | Total | Done | In Progress | Blocked | Todo |
| ----------- | ------- | ----- | ----------- | ------- | ------ |
| Phase 0 | 6 | 6 | 0 | 0 | 0 |
| Phase 1 | 8 | 8 | 0 | 0 | 0 |
| Phase 2 | 5 | 5 | 0 | 0 | 0 |
| Phase 3 | 4 | 4 | 0 | 0 | 0 |
| Phase 4 | 8 | 8 | 0 | 0 | 0 |
| Phase 5 | 4 | 4 | 0 | 0 | 0 |
| Phase 6 | 16 | 16 | 0 | 0 | 0 |
| Phase 7W1-5 | 26 | 19 | 1 | 1 | 5 |
| Phase 7W6 | 8 | 1 | 3 | 0 | 4 |
| Phase 7W7 | 9 | 0 | 0 | 0 | 9 |
| Phase 7W8 | 11 | 6 | 0 | 0 | 5 |
| Phase 7W9 | 10 | 0 | 0 | 1 | 9 |
| Phase 7W10 | 12 | 8 | 1 | 0 | 3 |
| Phase 7W11 | 16 | 0 | 2 | 1 | 13 |
| Phase 7W12 | 7 | 0 | 1 | 0 | 6 |
| Phase 7W13 | 3 | 0 | 0 | 0 | 3 |
| **Total** | **153** | **85**| **8** | **3** | **57** |
---
*Last updated by CEO audit — 2026-04-11 (Wave 12 added from [TEC-1895](/TEC/issues/TEC-1895) — TEC-1898 through TEC-1900)*