From ee5fe6d15b9d56ea51d0f3c87d532df061273fa2 Mon Sep 17 00:00:00 2001 From: ngqile Date: Tue, 1 Dec 2026 10:44:58 +0800 Subject: [PATCH] docs: lead dashboard SQL and release notes Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- docs/deployment.md | 9 +++++++++ openspec/changes/add-lead-dashboard/tasks.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/deployment.md b/docs/deployment.md index 421ac2b..455c089 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -97,6 +97,14 @@ After running `04`, `SELECT LENGTH(password) FROM \`service-system\`.\`user\` WH Run the three in order, with a user that may alter tables. File `03` ends every admin session: everyone signs in again, staff with company `ins`. `99-rollback.sql` in the same folder undoes the three. It fails on the username unique key once two companies have a user with the same username; rename one of them first. +| File | What it does | +|---|---| +| `openspec/changes/archive/2026-12-01-add-lead-dashboard/sql/01-status-change.sql` | Creates `service-counter`.`event_lead_status_change` (every event-lead status change with its time and user) and an index on `event_lead` for the dashboard. DDL. | +| `openspec/changes/archive/2026-12-01-add-lead-dashboard/sql/02-status-change-backfill.sql` | Gives event leads captured before this release a history: OPEN at capture, and the current status at the last update. These times are approximate. Safe to run twice. | +| `openspec/changes/archive/2026-12-01-add-lead-dashboard/sql/03-dashboard-module.sql` | Adds the Dashboard back-office module (`BO_DASHBOARD`). No role gets it; super admins grant it under Roles. | + +Run the three in order before the new images go live: the new services-counter writes to the table from `01` on every capture and status edit, and fails without it. `01` needs a user that may create tables. `99-rollback.sql` in the same folder undoes them and deletes the status history. + **Database user:** - Create one user with `SELECT, INSERT, UPDATE, DELETE, EXECUTE` on the five schemas. EXECUTE is needed: service-member calls a stored function. - Every Java service reads the same variables (section 6): `MYSQLHOST`, `MYSQLPORT`, `MYSQLUSER`, `MYSQLPWD`. @@ -293,6 +301,7 @@ data: - **No email provider yet.** Staff onboarding does not need one: the admin types each new user's first password, and "Set temporary password" on a user's page unlocks a user who forgot theirs. Both force a password change at the next sign-in. Forgot-password and "Send password reset" still create an email with a temporary password. Nobody receives it, but `service-email` saves every email first, so a super admin (or a role granted Emails) can read it under **Emails** and pass the password on in person. The user must change it at the next sign-in. Grant Emails narrowly: it shows every saved email, including other users' temporary passwords, member email-verification codes, and contact or distributor form submissions with the sender's personal data. - **Sign-in lockout.** 5 failed sign-ins within 15 minutes lock a username, even with the right password, until 15 minutes after the first of those failures, and unknown usernames are counted too. Anyone who knows a username can therefore lock it on purpose. An admin with **Login security** can unlock it at once (Locked tab), and can change the limits there. If every super admin is locked, wait out the period. The lock check fails open: if `service-system` is down, sign-in still works without the lockout. - **Companies and super admins.** INS and CV each see only their own leads, events, event leads, users, emails, login history and audit log. Staff sign in with their company code, username and password. A super admin leaves Company blank, sees every company (with a company picker in the header), and is the only one who can manage companies, roles, interests, lockout settings and password rules. Changing a company's code renames its staff's sign-in names and signs them out; deactivating a company blocks its staff from signing in. Emails sent from public forms and other system emails have no company, so only super admins see them. Do not give a company's old code to another company while sessions opened under the old code may still be valid: such a session token would resolve to the new company's user of the same name. When in doubt, never reuse a code. +- **Lead dashboard.** Users whose role has the Dashboard module see lead captures, wins, conversion and overdue follow-ups on the home page, for this month, last month or a custom range of up to two years in Malaysian time. A lead counts as converted when its status at an event is WON. Wins and days to win come from the status history, which starts with this release; for older leads it is approximate (see section 3). - **Reference data from Tastefully.** It still holds some Tastefully business text (message templates with a phone number, bank account and form links; a public image bucket URL; Tastefully usernames in audit columns). Review it before go-live. - **Other Tastefully defaults.** The sender addresses in `service-email` and the `CUSTOMER_PORTAL_BASE_URL` fallback point at Tastefully. Override them as described in section 6. - **Leaked SMS key.** An SMS360 API key from Tastefully was in `service-email`'s config and is in git history. It has been removed from the config, but it must be rotated with SMS360 before go-live, by whoever owns that Tastefully account. diff --git a/openspec/changes/add-lead-dashboard/tasks.md b/openspec/changes/add-lead-dashboard/tasks.md index 0944279..2b81b53 100644 --- a/openspec/changes/add-lead-dashboard/tasks.md +++ b/openspec/changes/add-lead-dashboard/tasks.md @@ -57,7 +57,7 @@ Waves: ## 5. Release -- [ ] 5.1 `docs/deployment.md` lists the SQL; live check against the local stack (seeded INS and CV event leads with status changes), and Playwright at 1280 and 360 px for a granted user, a user without the module, and a super admin switching company. +- [x] 5.1 `docs/deployment.md` lists the SQL; live check against the local stack (seeded INS and CV event leads with status changes), and Playwright at 1280 and 360 px for a granted user, a user without the module, and a super admin switching company. - Depends on: 1.1 to 4.1 - Scope: `docs/deployment.md`, `openspec/changes/add-lead-dashboard/tasks.md` - Verify: full `mvn -T 1C -q verify` of the three touched Maven modules and the portal verify.