01 · Data architecture
Database
Schema Map
49 ตาราง แยกตาม domain พร้อม keys, status/financial fields, relationships, API และหน้า frontend ที่เกี่ยวข้อง ไม่มี row data
ตารางตาม business domain
ค้นหาชื่อตารางหรือ field/domain ได้ ตารางฉบับละเอียดทุก field อยู่ใน Markdown
| Domain | Tables | Key status / financial concerns | Primary consumers |
|---|---|---|---|
| Customer & KYC | customers, customer_addresses, customer_employments, customer_references, customer_relations, customer_status_history, customer_referrals, guarantors, minor_guardians | customer/portal status, identity field names, KYC completeness | customer APIs; customers/contracts/customer portal |
| Savings | savings_accounts, savings_transactions, savings_periods, savings_allocations, savings_account_promotions, savings_account_credits | target/minimum/balance inputs, verification status, period status, conversion | savings APIs; contracts/customer views |
| Contracts | contracts, contract_documents, contract_benefits, contract_promotions, contract_payment_intents | contract lifecycle, down payment, finance/loan/installment values, intent verification | contract/payment APIs; contracts/customer portal |
| Payments | payment_schedules, payments, payment_allocations, payment_reschedules, penalty_rules | due dates, amounts, penalties, paid/verification/approval status | schedule/intents/payoff/dashboard/follow-ups |
| Cash sales | cash_sales, cash_sale_refunds, cash_sale_promotions | gross/discount/net/refund amounts, transaction status | cash-sales APIs and page; dashboard |
| Promotions | promotions, promotion_packages, promotion_benefits, promotion_benefit_items, promotion_eligibility_rules, promotion_events, promotion_event_applications, promotion_event_referrals, promotion_redemptions | active windows, qualification/reward values, application/redemption status | promotion APIs; promotions/contracts/cash/customer portal |
| Products | products | cost and selling price, variant descriptors | products/contracts/cash sales |
| Staff & authorization | employees, roles, role_permissions, auth_login_failures | account status, role/permission flags, abuse protection metadata | auth and employee APIs |
| Service workflow | follow_up_logs | follow-up type/date/status, payment-pause request | follow-up/support APIs; follow-ups/dashboard |
| Integrity & audit | audit_logs, business_idempotency_keys, financial_action_requests, document_sequences, schema_migrations, migration_data_conflicts | mutation trace, idempotency, action authorization, sequence/migration state | shared backend helpers and tooling |
Core relationship spine
Customer
customers → savings_accounts → savings_transactions → savings_allocations → savings_periodsContract
customers → contracts → payment_schedules → paymentsPayment review
contracts → contract_payment_intents → payment_schedulesSale
customers → cash_sales → cash_sale_refundsPromotion
promotions → promotion_packages → benefits/rules → applications/redemptions