Commit Graph
3 Commits
Author SHA1 Message Date
rick 51f40a5443 Add data migration tool — verified against production data (section 8)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
Full ETL migration from v5 Swarmops MySQL to v6 UsingCash schema.
Tested against a real production mysqldump (sha256: 735ba82d...06850e).

Migration results (all verified):
- 246 currencies, 2 organizations (with OOD denormalization)
- 4 users (from People), 147 financial accounts
- 4,010 transactions, 8,590 rows (67 with foreign currency)
- 1,227 dependencies (28 continuation chains preserved)
- 292 expense claims, 283 inbound invoices (with OOD), 101 outbound
- 422 payouts, 98 payment groups, 98 payments
- 2,863 documents, 3,570 exchange rate snapshots + 614,750 datapoints
- 36 hot wallet addresses + 44 UTXOs, 12 dep types, 21 settings

Verification passed on all three levels:
- Transaction row totals per org/year: exact match
- Per-account balance totals (100 accounts): exact match
- Record counts for all major tables: exact match

Key implementation details:
- Reads v5 ObjectTypes + ObjectOptionalDataTypes lookup tables to
  map EAV data by name (not hardcoded IDs)
- Denormalizes OOD into first-class v6 columns for orgs, accounts,
  invoices, transactions
- ClosedThroughYear: uses v5 OrgBooksClosedForYear when present,
  fallbacks only if missing
- OrgOpenLedgersDomain and OrgVanityDomain preserved (schema updated)
- Batched INSERT for exchange rate datapoints (614K rows in ~4 min)
- Handles MySQL zero-datetime values gracefully
- Triggers must be disabled during migration (historical data loading)
  then re-enabled after

Made-with: Cursor
2026-04-08 18:16:30 +02:00
rick ff7b4b88ff Add Logic Layer — business rules and domain types (section 7)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
Core infrastructure:
- SingularFactory: reflection-based Basic→Logic type hydration with
  startup cache warming and fail-fast on missing mappings
- PluralBase<TPlural, TSingular, TBasic>: typed collection hydration
- DependencyTypeCache: name→id mapping loaded once from DB

Financial core:
- FinancialAccount: balance computation, delta calculation, sign modifier
  for result accounts, closed-period enforcement on rename/reparent
- FinancialTransaction: AddRow with continuation transaction support
  (creates/reuses continuation in open period when tx is in closed year),
  RecalculateTransaction across continuation chains, dependency management
- Reports: BalanceSheet and ProfitAndLoss report generation from repo data
- ExchangeRateService: BTC-hub model, micro-BTC scaling (÷1M, BCH exception),
  provider chain with fallback support
- BitPayRateProvider: proper JSON deserialization replacing v5 regex parser
- IRateProvider interface for pluggable rate sources
- IBlockchainProvider + Utxo record for chain abstraction (BCH in Bucket 1)

AP/AR with VAT booking:
- ExpenseClaim.Create: VAT-aware split (net to budget, VAT to
  AssetsVatInboundUnreported), closed-year date bumping, self-attestation
- InboundInvoice.Create: same VAT split pattern, native currency support
- OutboundInvoice.Create: outbound VAT to DebtsVatOutboundUnreported

Structure & Identity:
- Organization: FromBasic with all denormalized OOD settings
- User: FromBasic, PBKDF2 password hashing, constant-time verification

Support:
- IDocumentStorage + LocalFilesystemStorage (yyyy/mm/dd paths, configurable root)
- MailService: template rendering with %placeholder% substitution, direct send
- EventBus: typed publish/consume with JSON serialization, retention purge
- DashboardTaskService: expense/invoice attestation tasks per budget owner

Made-with: Cursor
2026-04-08 17:24:05 +02:00
rick 8aafe681b1 Scaffold v6 solution, frontend, CI, and Docker
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
Section 1 complete (tasks 1.1-1.7):
- .NET 8 solution with 8 projects (Common, Basic, Database, Logic, Api,
  Backend, Migration, Tests) and correct dependency graph
- NuGet deps: MySqlConnector, NBitcoin, Microsoft.Extensions.Hosting,
  xunit, coverlet
- Common layer: IHasIdentity, enums (Permission, FinancialAccountType,
  DocumentType, CryptoChain, ExpenseClaimStatus, InvoiceStatus,
  PayoutStatus, FinancialDependencyType)
- React + TypeScript + Vite frontend with MUI, react-router, react-i18next
- Localization: EN, SV, DE translation files
- Vite builds to src/UsingCash.Api/wwwroot for static serving
- Multi-stage Dockerfile: Node build + .NET build -> aspnet runtime
- Gitea Actions CI: build, test, lint, Docker image
- appsettings.json with read/write/admin DB credential structure

Also updates data-migration spec/design for mysqldump-based workflow.

Made-with: Cursor
2026-04-08 16:21:00 +02:00