Skip to main content
Version: 1.0.0
Status: 📝 Planned
Related Specs: FA-01, FA-02, FA-04, FA-08
Constitution Reference: Section 3.1 (Module Settings Pattern)

1. Overview

Every domain core should have a {core}_module_settings table and admin page for organization-level configuration. This document specifies the FA (Finance & Accounting) module settings implementation.

2. Database Schema

Table: fa_module_settings


3. Frontend Implementation

3.1 Admin Page

Location: src/cores/fa/pages/FASettings.tsx
Route: /fa/settings
Access: org_admin only
Layout:

3.2 Settings Form Component

Location: src/cores/fa/components/FASettingsForm.tsx Tabs Structure:
  1. General Ledger - Default accounts, fiscal year settings
  2. Accounts Payable - Payment terms, approval thresholds, PO requirements
  3. Accounts Receivable - Invoice terms, late fees, payment application
  4. Bank Reconciliation - Approval requirements, variance thresholds
  5. Budgeting - Approval workflow, alert thresholds, over-budget controls
  6. Reporting - Default formats, consolidation, fund accounting
  7. Compliance - Dual approval, period restrictions, audit controls
  8. Notifications - Alert preferences for period close, budgets, large transactions
Example Tab:

3.3 Hook

Location: src/cores/fa/hooks/useFAModuleSettings.ts

4. Navigation Integration

Add to FA Module Registry

File: src/platform/navigation/module-registry.ts

Add Route

File: src/App.tsx

5. Usage in Other FA Modules

Example: FA-02 (General Ledger)

Example: FA-04 (Accounts Payable)

Example: FA-08 (Budgeting)


6. Implementation Checklist

  • Create fa_module_settings table with RLS policies
  • Add set_updated_at trigger
  • Create seed_fa_module_settings() function
  • Create hook: useFAModuleSettings.ts
  • Create form: FASettingsForm.tsx with 8 tabs
  • Create page: FASettings.tsx
  • Add route to App.tsx
  • Add navigation item (org_admin only)
  • Document in IMPLEMENTATION_LOG.md
  • Update FA-01, FA-02, FA-04, FA-08 specs to reference module settings

7. Testing Requirements

Unit Tests

  • Settings hook fetches and updates correctly
  • Default values applied when creating new settings
  • Form validation for numeric thresholds

Integration Tests

  • Only org_admin can access settings page
  • Settings auto-created on first access
  • Settings apply correctly across FA modules (GL, AP, AR, Budget)

RLS Tests

  • Users in org can view settings
  • Only org_admin can update settings
  • Users outside org cannot view/modify settings

8. Documentation

Update IMPLEMENTATION_LOG.md: