Implemented the database, authentication, access rules, and seed data
This commit is contained in:
+22
-10
@@ -1,25 +1,37 @@
|
||||
# MerchantFlow product brief
|
||||
|
||||
A local test-assignment prototype for a fictional crypto-payment provider. The first milestone is a usable, read-only CRM foundation with real authentication, persisted sample records, responsive navigation, and EN/RU localization.
|
||||
A local merchant-onboarding CRM for a fictional crypto-payment provider, with persisted records, real authentication, permission-enforced workflows, responsive navigation and EN/RU localization.
|
||||
|
||||
## People and access
|
||||
|
||||
Four seeded accounts: one Head of Sales, one Compliance Officer, two Account Managers. The Head sees all merchants. Compliance sees only merchants currently in KYB or Compliance Review. Managers see only their assigned merchants. These scopes apply to details, lists, metrics, history, tasks, and search. The Review Queue is exclusive to Compliance, including direct API requests.
|
||||
Four seeded staff accounts: Head of Sales, Compliance Officer, Alex Morgan and Sam Taylor. Head sees the portfolio and team activity, assigns/reassigns managers and manages commercial onboarding. Managers see and edit only assigned merchants and related commercial activities/tasks; they cannot change ownership. Compliance sees merchant context and KYB across the portfolio, records reviews and KYB notes, and manages personal compliance tasks. Compliance cannot edit commercial details, change ownership or activate merchants. Sales cannot issue or override compliance decisions. The Review Queue is Compliance-only.
|
||||
|
||||
NestJS authorization and database predicates apply to all reads, searches, counts, detail children, dashboards and mutations. A hidden resource returns 404; a forbidden action on a visible resource returns 403. The UI reflects server capabilities.
|
||||
|
||||
## Onboarding
|
||||
|
||||
New Lead → Contacted → Qualified → KYB → Compliance Review → Integration → Testing → Live.
|
||||
New Lead → Contacted → Qualified → KYB → Compliance Review → Integration → Testing → Live. Rejected is an alternate terminal outcome; neither Live nor Rejected has outgoing stage actions. The same merchant ID persists throughout.
|
||||
|
||||
Rejected is an alternate terminal outcome, never a step after Live. Compliance may return a review to KYB for corrections. KYB uses document checklists and notes without uploads. Names and notes remain exactly as entered. Status and role codes remain canonical; labels are translated.
|
||||
Assignment is required before leaving New Lead. Sales collects the four KYB documents. All must have received-history evidence before submission creates a pending review. Reviewed company/KYB fields freeze during review. Compliance approval advances to Integration; rejection requires a reason; corrections require a reason and item-specific notes and return the merchant to KYB. Resubmission creates another review cycle. Decisions are immutable.
|
||||
|
||||
## Foundation journeys
|
||||
Reviewed company identity, website, country, industry and KYB items remain locked after approval. Contact details, volume estimates, source and authorized ownership can change. Head or the assigned manager may advance Integration → Testing → Live only with matching approval/checklist evidence. Reassignment transfers open commercial tasks, preserving completed attribution and personal Compliance tasks.
|
||||
|
||||
Public landing → login → role-scoped dashboard → merchant search/filter → merchant detail, checklist, notes, history, tasks. Separate Pipeline and Tasks pages and a Compliance-only Review Queue. Records are read-only in this milestone. Tasks and reminders are displayed inside the app. Dashboard values come from database records and historical events.
|
||||
## Journeys and records
|
||||
|
||||
Landing → email/password login → role-scoped dashboard → merchant search/filter → detail, editing, assignment, checklist, reviews, interactions, history and tasks. Pipeline, Tasks and Compliance Review Queue provide dedicated views. Tasks can be created, edited and completed from merchant details; reminders stay in the app.
|
||||
|
||||
Merchants include company and primary-contact details, website, country, industry, decimal USD volume estimates, source, nullable manager, stage, timestamps and a concurrency version. Related models retain activities, stage events, checklist changes, review snapshots and task attribution. Mutations and audit history commit atomically and reject stale versions.
|
||||
|
||||
## Authentication and demo data
|
||||
|
||||
Salted password hashes; opaque eight-hour database-backed sessions in HttpOnly, SameSite cookies; Secure cookies in production; exact trusted-Origin checks for all mutations; bounded IP/email login limits. No authentication tokens in browser storage and no public staff registration.
|
||||
|
||||
Demo addresses: head@merchantflow.test, compliance@merchantflow.test, alex@merchantflow.test, sam@merchantflow.test. Initial password: `MerchantFlow123!`. Seed 45 fictional merchants, five unassigned New Leads and 20 per manager, across all stages. Histories span 90 days and include interactions, document corrections, review outcomes and overdue/upcoming/completed tasks. Advanced successful fixtures have valid approval and checklist history. Dashboard values derive from those records.
|
||||
|
||||
Seeding uses stable IDs, a stored date anchor and a version marker. It preserves edits and existing passwords. Only recognized unchanged foundation fixtures receive inferred historical enrichment; modified legacy fixtures are reported and preserved.
|
||||
|
||||
## Defaults and boundaries
|
||||
|
||||
English is the default. Persist EN/RU selection in browser storage. Dates use the selected locale and the viewer's local time zone. Light neutral UI, restrained lime accents, visible focus, touch-sized controls, reduced-motion support. No merchant self-service, real payment processing, external KYB integration, uploads, external notifications, or deployment.
|
||||
English is the default; EN/RU selection persists in browser storage. Dates use the selected locale and viewer's time zone. Names and notes remain verbatim; canonical status/role labels are translated. Retain the light neutral UI, lime accents, visible focus, touch-sized controls and reduced-motion support.
|
||||
|
||||
## Later milestones
|
||||
|
||||
Merchant create/edit and owner assignment; permission-aware pipeline transitions with atomic history; Compliance approve/reject/return-to-KYB with correction notes; checklist editing; task/reminder create/edit/complete. These require explicit workflow permission and validation rules before implementation.
|
||||
No merchant creation/deletion UI, staff registration, merchant self-service, real payments, external KYB integration, uploads, external notifications or deployment.
|
||||
|
||||
Reference in New Issue
Block a user