3be41639ea722104a0e18cd8b136bb5f20b0a40e
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3be41639ea |
Update OpenSpec artifacts to reflect implementation reality
design.md — 6 new decisions: - D19: AccountTreeGrid with Σ crossfade animation - D20: Three-tab Inspect Ledgers (huvudbok/grundbok/search) - D21: Transaction detail dialog with balanced indicator - D22: [LOC] account name resolution (with future multi-language path via Accept-Language for Open Ledgers) - D23: No server-side PDF rasterization (browser renders natively) - D24: CI with local NuGet/npm cache mirrors (Nexus) design.md — 7 new resolved questions: - Document rasterization eliminated - Migration from mysqldump (not live DB) - OOD lookup table mapping by name (not hardcoded IDs) - Open Ledgers locale per-request via Accept-Language - VAT amount entry: manual inbound, pre-filled outbound - Frontend state management: simple hooks, no framework specs/frontend-app — major expansion: - AccountTreeGrid component spec with crossfade scenarios - Balance Sheet/P&L with quarterly columns spec - Inspect Ledgers three-tab spec with 7 detailed scenarios - [LOC] account name resolution spec - Chart of accounts tree spec specs/documents — new requirements: - No server-side PDF rasterization - Legacy rasterized document support - Meaningful download filenames from business objects specs/data-migration — additions: - OOD lookup table discovery detail - Verified production migration results with exact counts - Implementation notes (batched inserts, zero-datetime, triggers) tasks.md — honest reconciliation: - Section 9: 16 of 21 tasks marked done (was 0/17) - Section 10: 10.7 marked done with full description - New tasks: 9.18 (LOC resolver), 9.19 (RBAC), 9.20 (org-scoping), 9.21 (closing journal) - Total: 137 done, 13 remaining (was 119/146) Made-with: Cursor |
||
|
|
86d9a9da79 |
Add backend worker, bootstrap, and tests (sections 11-13)
Section 11 — Backend Worker: - BackgroundWorkerService: IHostedService with 7 scheduled tasks (heartbeat, exchange rates, mail queue, event bus, blockchain monitor, forex P&L, auto payouts) on configurable intervals - SchemaVersionCheck: IHostedLifecycleService that verifies schema version on startup - Worker registered in API host (in-process) Section 12 — Bootstrap: - 009-bootstrap.sql: creates System Administrator role with all permissions and initial admin user Section 13 — Tests (21 passing): - MoneyTests: storage, display (fiat/crypto), arithmetic, currency enforcement, ToCurrency with double, equality, zero - UserPasswordTests: PBKDF2 hash format, correct/wrong password verify, different salts, malformed hash handling - EnumConsistencyTests: account types, permission count, dependency types, expense claim lifecycle Also fixes task list honesty: 10 frontend pages correctly marked as placeholders pending implementation. Made-with: Cursor |
||
|
|
45f026b4f4 |
Add React frontend with live data pages (section 10)
Full React + MUI + TypeScript SPA at frontend/: - API client with typed interfaces for all endpoints - AuthContext (session cookies, dev impersonation) - OrgContext (org list, active org switcher) - Money formatting (cents → display, satoshis → BCH) App shell: - Sidebar navigation with collapsible Ledgers and Financial sections - Top bar with org switcher, language selector (EN/SV/DE), user chip - Material UI theme with Inter font Live data pages (connected to real migrated production data): - Dashboard: YTD P&L cards, pending tasks, quick links - Balance Sheet: date picker, assets/debts tables with totals - Profit & Loss: year selector, income/costs breakdown, net result - Chart of Accounts: grouped by type with status chips - Crypto Treasury: total balance, address table with BCH amounts - Expense Claims: list with amounts, VAT, status chips Placeholder pages for: Inspect Ledgers, Budget vs Actual, Inbound/ Outbound Invoices, Payouts, End of Month, Org Settings, User Management Vite dev server proxies /api to ASP.NET Core backend on port 5222. Made-with: Cursor |
||
|
|
51f40a5443 |
Add data migration tool — verified against production data (section 8)
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 |
||
|
|
ff7b4b88ff |
Add Logic Layer — business rules and domain types (section 7)
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 |
||
|
|
f9dbb889f9 |
Add Database Layer and Common/Basic types (sections 5-6)
Section 6 — Common & Basic Layers: - Money value type: Int64 cents, currency-aware arithmetic, ToCurrency with double intermediate (deliberate), display formatting for fiat (2 decimal) and crypto (6 decimal) - 16 Basic types matching v6 schema: BasicOrganization (all denormalized OOD fields), BasicUser, BasicFinancialAccount (OwnerUserId, native currency, bitcoin fields), BasicFinancialTransaction (OrganizationSequenceId, BlockchainHash), BasicFinancialTransactionRow (foreign currency, bitcoin derivation), BasicExpenseClaim, BasicInboundInvoice, BasicOutboundInvoice, BasicPayout, BasicPayment, BasicPaymentGroup, BasicRefund, BasicDocument, BasicCurrency, BasicHotWalletAddress, BasicHotWalletUtxo Section 5 — Database Layer: - DatabaseConnection: three-tier factory (read/write/admin), Galera-aware, MySqlConnector-based - DatabaseCredentials + DatabaseConfig for appsettings binding - RepositoryBase: stored proc + text command helpers, parameter binding, type-safe reader helpers - FinancialRepository: accounts, transactions, rows, dependencies, balances, budgets, unbalanced tx detection, period closing - ApArRepository: expense claims, inbound/outbound invoices, payouts - UserRepository: users, RBAC permissions, role assignment - OrganizationRepository: orgs with full denormalized settings - CryptoRepository: hot wallet addresses, UTXOs - DocumentRepository: document metadata, typed foreign object queries - CurrencyRepository: currencies, exchange rate snapshots/datapoints with micro-BTC scaling awareness - SupportRepository: mail queue, event queue, system settings, templates Made-with: Cursor |
||
|
|
40eefc6163 |
Add stored procedures, triggers, grants, and seed data (section 4)
Stored procedures organized by domain: - 003-procedures-financial.sql: CreateFinancialTransaction (with gap-free OrganizationSequenceId), AddTransactionRow (with foreign currency), tag/dependency management, account CRUD, budgets, period closing - 004-procedures-apar.sql: Expense claims (with VatCents, groups), inbound/outbound invoices (with sequence IDs, VAT), payouts, payments, payment groups, refunds, documents - 005-procedures-support.sql: Users, RBAC (roles/permissions/assignments), organizations (VAT config, tax info), crypto (hot wallet addresses, UTXOs), exchange rates (micro-BTC scaling), mail queue, event queue, system settings Security layer: - 006-triggers.sql: INSERT/UPDATE/DELETE triggers on FinancialTransactionRows that reject operations where the transaction date falls in a closed fiscal period (defense-in-depth alongside application enforcement) - 007-grants.sql: Three-tier MySQL users (uc_read SELECT, uc_write EXECUTE, uc_admin ALL) Seed data: - 008-seed.sql: Financial dependency types, BCH crypto chain, schema version Combined initialization script: - 000-initialize.sql: Runs all files in order Made-with: Cursor |
||
|
|
0514b9bd18 |
Add v6 database schema DDL (sections 2-3)
Two schema files covering all v6 tables: - 001-tables.sql: Organizations (denormalized OOD), Users, Roles/RBAC, FinancialAccounts (with OwnerUserId, native currency, bitcoin fields), FinancialTransactions (with OrganizationSequenceId, BlockchainHash), FinancialTransactionRows (with foreign currency, bitcoin derivation), Dependencies, Tags/TagSets/TagTypes, Budgets - 002-tables-apar.sql: ExpenseClaims (with VatCents, groups), InboundInvoices (with native currency, bitcoin satoshis), OutboundInvoices + Items (with credit links, VAT), Payouts, PaymentGroups, Payments, Refunds, Documents, FinancialAccountDocuments, Currencies, ExchangeRateSnapshots + Datapoints (micro-BTC scaling), CryptoChains, HotWalletAddresses, HotWalletUtxos, MailQueue, MailTemplates, EventQueue, SystemSettings Key v5→v6 differences: - ObjectOptionalData EAV denormalized to first-class columns - FinancialTransactionRowsNativeCurrency merged into Rows table - People → Users (simplified, no geography/membership) - utf8mb4 throughout, no legacy latin1 - Amount (double) columns removed; AmountCents (bigint) only - Budget tables unified (annual + monthly in one table) - v5 FlatData → SystemSettings Also updates data-migration spec for mysqldump-based workflow. Made-with: Cursor |
||
|
|
8aafe681b1 |
Scaffold v6 solution, frontend, CI, and Docker
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 |
||
|
|
212f19ac19 |
Add v6-rewrite OpenSpec: proposal, design, specs, and tasks
Complete specification for rewriting Swarmops v5 as using.cash v6: - Proposal: scope buckets (Working Rewrite / First Beyond Working / Maybe), non-goals (governance, geography, memberships permanently cut) - Design: 18 architectural decisions including preserved patterns (Basic/Logic, stored procs, credential split), new patterns (repository classes, chain abstraction, rate providers), and operational concerns (Galera awareness, continuation transactions, VAT booking, OOD denormalization) - Specs: 17 capability specifications with SHALL/MUST requirements and WHEN/THEN scenarios, covering accounting core, AP/AR, crypto treasury, exchange rates, organizations, users/auth, documents, comms, dashboard, end-of-month, backend worker, event bus, data migration, API layer, frontend app, and CI/packaging - Tasks: 145 implementation tasks grouped by subsystem, ordered by dependency (migration gates API/frontend work) Two rounds of adversarial review incorporated. Made-with: Cursor |