Commit Graph
4259 Commits
Author SHA1 Message Date
rick 8dea39d16c Add HANDOFF.md for session continuity
CI / build-and-test (push) Failing after 3h11m35s
CI / docker (push) Has been cancelled
Comprehensive handoff document covering:
- What's built and working (backend, frontend, data, infrastructure)
- What's next: write path with replayability (new scope), remaining
  forms, read pages, security, deferred items
- Key design decisions to know (unit model, VAT, continuations, etc.)
- Dev environment setup commands
- OpenSpec artifact locations
- Files to read first for context

Made-with: Cursor
2026-04-20 12:39:35 +02:00
rick bb37f83a87 Add smart MoneyInput, DateInput, and expense claim submission form
CI / build-and-test (push) Failing after 3h10m29s
CI / docker (push) Has been cancelled
MoneyInput component:
- Accepts flexible monetary input: 1234.50, 1234,50, 1.234,50, 1,234.50
- Heuristic: if both dot and comma present, last one is decimal separator
- If single separator followed by exactly 3 digits, it's thousands
- Shows "→ formatted" confirmation below the field while typing
- Returns value in cents (Int64) to parent
- Right-aligned monospace display with currency code adornment
- On blur, replaces raw input with formatted value

DateInput component:
- Wrapper around native date picker
- Always stores/communicates ISO 8601 (YYYY-MM-DD)

ExpenseClaimFormPage:
- Description, date, budget account selector, total amount, VAT amount
  (when org VatEnabled), receipt upload, submit button
- Finds system accounts (Expense Claims debt, VAT inbound) automatically
- Shows net amount (excl. VAT) when VAT is entered
- Uploads attached document after claim creation
- Redirects to expense claims list on success
- "File Expense Claim" button added to expense claims list page

Made-with: Cursor
2026-04-13 12:00:36 +02:00
rick 3a04b175a1 AGENTS.md: add spec sync to close-out workflow
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
Made-with: Cursor
2026-04-13 11:54:04 +02:00
rick 286633fc92 Apply CI lessons from Sonarr pipeline work
CI / build-and-test (push) Failing after 2h54m27s
CI / docker (push) Has been skipped
CI workflow:
- Force IPv4 DNS resolution (DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_DNSRESOLUTIONFAMILY)
  to avoid IPv6 flakiness in K8s runners
- DOTNET_CLI_TELEMETRY_OPTOUT=1
- NUGET_HTTP_TIMEOUT=300 for slow cache warming
- npm --network-timeout 120000 for CI resilience

AGENTS.md:
- Added OpenSpec Artifact Persistence section (commit after every phase,
  verify before any phase, never re-scaffold)
- Added Archive = Full Close-Out section (complete sequence: commit,
  merge, push, archive, remove worktree)
- Added Build Pipeline Notes section (IPv4 DNS, timeouts, cache config)

Made-with: Cursor
2026-04-12 19:01:01 +02:00
rick b842934f39 Document unit model and flag BCH exchange rate exception for investigation
CI / build-and-test (push) Failing after 3h13m14s
CI / docker (push) Has been cancelled
accounting-core spec: clarified Money representation unit model:
  fiat cents ↔ crypto satoshis, dollars ↔ microcoins, both 2 decimal
  places. 1 microcoin = 100 satoshis, same as 1 dollar = 100 cents.

exchange-rates spec: added investigation warning for BCH exception.
  If BTC and BCH both use satoshi/microcoin units, the ÷1,000,000
  micro-BTC scaling should apply to BCH too. The current exception
  (BCH stored at face value) may be incorrect and could produce
  conversions off by 6 orders of magnitude. Action required: verify
  end-to-end with known amounts before live BCH conversions.

Made-with: Cursor
2026-04-10 16:51:43 +02:00
rick 3be41639ea Update OpenSpec artifacts to reflect implementation reality
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
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
2026-04-10 16:45:43 +02:00
Dolon c13f5da9a6 ci: wire repo action vars into cache mirror env
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
2026-04-10 08:22:30 +00:00
Dolon 6d87722cc8 ci: ignore failed cache source when falling back to nuget.org
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
2026-04-10 08:14:21 +00:00
Dolon 68a179b595 ci: support local NuGet/npm cache mirrors with fallback
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
2026-04-10 08:05:38 +00:00
rick e5bbe60660 Point dev document storage at copied production docstore
CI / build-and-test (push) Failing after 1h22m35s
CI / docker (push) Has been skipped
Made-with: Cursor
2026-04-09 15:31:29 +02:00
rick 80b6b55482 Make account rows clickable for transaction detail in General Journal and Search
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Made-with: Cursor
2026-04-09 15:06:48 +02:00
rick 14cfc14aaf Add Search tab with cross-account transaction search
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Backend: GET /api/organizations/{orgId}/search/transactions
- Text search on transaction description (case-insensitive)
- Tx# / sequence ID lookup
- Amount range (min/max in cents, matches absolute row amounts)
- Date range (from/to)
- Optional account filter
- Returns transactions with nested rows, same format as General Journal
- Results ordered by date descending, capped at 500

Frontend: SearchTab component
- Search bar with description field (autofocus, Enter to search),
  Tx# field, amount min/max, date from/to pickers, Search button
- Results displayed in General Journal format: transaction headers
  with account rows, clickable for transaction detail dialog
- "N transactions found" with query echo
- Empty state before first search, "No transactions found" after
- Same visual style as General Journal (badges, colSpan, monospace)

Search tab now enabled in the Inspect Ledgers tab bar.

Made-with: Cursor
2026-04-09 15:00:20 +02:00
rick d6929163ec Make entire ledger row clickable for transaction detail
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Made-with: Cursor
2026-04-09 14:01:17 +02:00
rick 4b63b085c8 Fix date column wrapping: wider (140px), whiteSpace nowrap
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Made-with: Cursor
2026-04-09 13:58:21 +02:00
rick 89145b98d8 Widen numeric columns in both ledger tabs for large amounts
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Debit/Credit columns: 100px → 130px
Balance column: 110px → 140px

Accommodates million-scale amounts like 1,992,983.52 without overflow.
Applied to both Account Ledger and General Journal tabs.

Made-with: Cursor
2026-04-09 13:55:42 +02:00
rick a33b11db74 Add transaction detail dialog, clickable from both ledger tabs
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
TransactionDetailDialog: shared modal showing full transaction info:
- Header: Tx#, balanced/unbalanced chip
- Date, description, currency
- Dependency link (Expense Claim #N, Invoice #N, etc.)
- Blockchain hash if present
- Documentation indicator
- Row table: account name, debit, credit, foreign currency, totals

Wired into both tabs:
- Account Ledger: Tx# column is now clickable (blue, underline on hover)
- General Journal: transaction header row is clickable (hover highlight)

Both tabs load account name map from /inspect/accounts-tree for the
dialog's account name resolution.

Also updated TransactionDetail API type to include hasDocumentation,
dependency, and foreign currency fields on rows.

Made-with: Cursor
2026-04-09 13:48:32 +02:00
rick 2ef34eadff Merge date+desc columns for account rows, fix Account Ledger balances
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
General Journal: account rows now use colSpan=2 to merge the Date and
Description columns, so the badge+account name starts under the
transaction date rather than being deeply indented under the description.
Creates a more natural visual hierarchy.

Account Ledger: fixed prior balance calculation for result accounts
(Income/Cost) — now computed from fiscal year start to period start,
matching the General Journal fix. Balance accounts (Asset/Debt) still
use all-time cumulative.

Made-with: Cursor
2026-04-09 13:39:13 +02:00
rick 599f58fa97 General Journal: inline badge+name, robust column widths
CI / build-and-test (push) Failing after 58s
CI / docker (push) Has been skipped
- Moved account type badge into the Description/Account cell, inline
  with the account name. Badge and name are now in the same column as
  the transaction description, creating natural visual alignment.
- Widened balance column to 120px, added whiteSpace: nowrap + overflow:
  hidden on all numeric columns to prevent layout breakage with large
  numbers.
- Trimmed Tx# column to 55px.

Made-with: Cursor
2026-04-09 13:34:59 +02:00
rick 88dab48cfe Fix General Journal: balance calculation, date width, badge alignment
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
- Fixed result account (Income/Cost) running balance: now computed from
  fiscal year start to period start, not from dawn of time. Balance
  accounts (Asset/Debt) still use all-time cumulative as before.
- Narrowed date column from 145px to 130px
- Right-aligned account type badge (pr: 4px) so it acts as a bullet
  point for the account name (pl: 4px), creating visual continuity
  between badge and account name across the column boundary

Made-with: Cursor
2026-04-09 13:26:01 +02:00
rick e5d77022c4 General Journal: per-row balance, wider date, remove collapse
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
- Added per-account running balance column: each row shows the account's
  balance after this specific row's delta is applied. Balance accounts
  (Asset/Debt) start from dawn-of-time prior balance; result accounts
  (Income/Cost) start from fiscal year start.
- Removed collapse/expand on transaction headers — they're just headers,
  not collapsible parents. Eliminates whitespace issue.
- Widened date column to 145px with whiteSpace: nowrap to prevent
  date wrapping across lines.
- Simplified component by removing all collapse state and animation code.

Made-with: Cursor
2026-04-09 13:06:14 +02:00
rick da4a2b5cbc Resolve [LOC] account names to human-readable display names
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
AccountNameResolver strips [LOC] prefix and looks up English display
names from a static dictionary matching the v5 .resx resource file.
Applied to all API endpoints that return account names:
- Inspect ledger (account ledger + general journal)
- Accounts tree dropdown
- Tree report endpoints (balance sheet + P&L)
- Account list endpoint

Examples: [LOC]Asset_BitcoinHot → "Bitcoin Hot Wallet",
[LOC]Cost_ForexLosses → "Forex Capital Losses",
[LOC]Debt_Equity → "Equity"

Non-[LOC] names (user-created accounts) pass through unchanged.
Future: load per-language from database for i18n support.

Made-with: Cursor
2026-04-09 12:51:59 +02:00
rick 635a1911ad Add tabbed Inspect Ledgers with General Journal (grundbok)
CI / build-and-test (push) Has been cancelled
CI / docker (push) Has been cancelled
Restructured Inspect Ledgers into three tabs:
- Account Ledger (huvudbok): existing view, moved to AccountLedgerTab
- General Journal (grundbok): new transaction-grouped view
- Search: placeholder (disabled)

General Journal features:
- Backend endpoint: /inspect/general-journal returns transactions with
  nested rows, account paths (Parent » Child), account types
- Transaction header rows: Tx#, date+time, description, doc indicator
- Expandable/collapsible per transaction with smooth animation
- Child rows: account type chip (color-coded), account path with
  parent breadcrumb, debit/credit columns
- Year/month selectors, transaction count, currency label
- Foreign currency chips on rows where applicable

Backend: queries all accounts for org, groups rows by transaction,
builds account paths from parent hierarchy, returns structured JSON.

Made-with: Cursor
2026-04-09 12:43:07 +02:00
rick b273e52778 Fix Inspect Ledgers: stable checkbox, currency code, clean state
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
- Checkbox for "own transactions only" now lives outside the
  data-dependent rendering block — visible whenever the selected
  account has children, regardless of query results
- Selected account stored as ID (number), not object reference,
  eliminating React re-render reference-equality issues
- isGroupAccount derived via useMemo from stable primitives
- ownOnly reset moved to onChange handler, not effects
- Autocomplete uses isOptionEqualToValue for stable comparison
- Currency code (SEK/EUR) shown in ledger header from org API

Made-with: Cursor
2026-04-09 11:48:34 +02:00
rick 15a0907561 Fix checkbox persistence and show currency code in Inspect Ledgers
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
- Checkbox "own transactions only" no longer disappears when checked:
  group state tracked from account selection, not from API response
- Reset ownOnly to false when switching accounts
- Currency code (SEK, EUR) shown instead of org name in ledger header
- Organization list and detail API endpoints now include currencyCode
  resolved from the Currencies table

Made-with: Cursor
2026-04-09 11:29:32 +02:00
rick 1bdb1fd3d5 Inspect Ledgers: group view, tree dropdown, prior/closing balance rows
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Backend: inspect/ledger endpoint now supports group queries:
- Selecting a parent account returns merged transactions from all
  descendants, sorted chronologically
- ?ownOnly=true filters to just the selected account's own transactions
- Response includes isGroup, groupAccountCount, accountName per entry

Frontend improvements:
- Account dropdown shows tree indentation matching account hierarchy
- Prior balance row at top of ledger, closing balance at bottom
- Period totals row shows only debit/credit sums (no balance)
- Account column appears automatically for group views
- Checkbox "Show only this account's own transactions (exclude
  sub-accounts)" appears when viewing a parent account with children
- Currency label above table
- Entries sorted by date within group view

Made-with: Cursor
2026-04-09 11:19:53 +02:00
rick bb240658fb Align tree grid header/footer padding + add initialExpanded prop
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
- Header and footer rows now use same CELL_PX padding as data rows,
  fixing horizontal misalignment of column values
- New initialExpanded prop: 'roots' (default), 'all', 'none', or
  Set<number> for specific node IDs

Made-with: Cursor
2026-04-09 11:03:35 +02:00
rick 42544242d9 Add Inspect Ledgers page and API endpoints
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Backend:
- GET /api/organizations/{orgId}/inspect/accounts-tree: flat account list
  grouped by type for the account selector
- GET /api/organizations/{orgId}/inspect/ledger: rich ledger entries with
  transaction comment, sequence ID, debit/credit split, running balance,
  foreign currency, dependency info — joins rows with parent transactions

Frontend:
- InspectLedgersPage: searchable Autocomplete account selector grouped
  by account type, year/month dropdowns, transaction grid with Tx#,
  date+time, description (with tooltip), debit, credit, running balance,
  foreign currency chips, period totals row, prior balance display
- Fixed column widths via tableLayout: fixed + colgroup

Also cleans up unused imports in AccountTreeGrid and removes stale
AnimatedRow function.

Made-with: Cursor
2026-04-09 11:00:05 +02:00
rick 90b9bc2425 Polish AccountTreeGrid: dual-value crossfade and smooth animations
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
The tree grid now matches v5 Open Ledgers behavior:

Value crossfade (v5 pattern):
- Each parent cell holds BOTH the aggregate (Σ) and own value
- Two absolutely-positioned overlapping elements at right: 0
- isCollapsed toggles opacity between them via CSS transition
- One fades out, the other fades in — pure crossfade, no value swap
- Single state change drives everything, no JavaScript animation timing

Row animation:
- AnimatedCellContent wraps each cell's content in a height-animated div
- Fixed ROW_HEIGHT (28px) for consistent layout
- overflow: hidden clips vertically without horizontal shift
- Children slide in/out simultaneously with the parent value crossfade

Column stability:
- tableLayout: fixed with colgroup for locked column widths
- All cells use identical CELL_PX padding
- DualValueCell shared between root and animated rows
- position: absolute + right: 0 ensures alignment regardless of text length

Visual polish:
- Σ prefix: 14px bold, only on collapsed non-zero aggregates
- Expanded parents with zero own-value show empty (reduce clutter)
- Chevron rotates 90° smoothly on expand
- Folder/FolderOpen icons for parents, Description for leaves

Made-with: Cursor
2026-04-09 10:51:01 +02:00
rick afde51abf2 Add AccountTreeGrid component and tree report endpoints
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
New reusable AccountTreeGrid component:
- Hierarchical tree with expand/collapse per node
- Σ prefix on aggregated parent values when collapsed
- Parent nodes show sum of all descendants when collapsed
- Own-value shown when expanded (for nodes with direct amounts)
- Column totals invariant: same regardless of expand/collapse state
- Folder/document icons matching v5 visual language
- CSS transitions on hover and state changes
- CSV download support per section

New backend endpoints:
- GET /api/organizations/{orgId}/reports/balance-sheet-tree?year=N
  Returns accounts with quarterly columns: Start, Q1, Q2, Q3, Q4, Current
- GET /api/organizations/{orgId}/reports/profit-loss-tree?year=N
  Returns accounts with: Last Year, Q1, Q2, Q3, Q4, YTD

Rebuilt pages using tree grid:
- Balance Sheet: Assets and Liabilities sections with quarterly breakdown
- Profit & Loss: Revenue and Expenses sections with quarterly breakdown,
  net result chip, CSV download

Modeled after v5 Open Ledgers treegrid functionality.

Made-with: Cursor
2026-04-09 09:38:56 +02:00
rick c2f251fc39 Fix invoice attest bug: was calling expense claim stored procedure
CI / build-and-test (push) Failing after 1h12m45s
CI / docker (push) Has been skipped
InvoiceEndpoints.cs called SetExpenseClaimAttested instead of
SetInboundInvoiceAttested — a copy-paste bug that would have updated
the wrong table. Added the missing SetInboundInvoiceAttested method
to ApArRepository.

Found by adversarial code review.

Made-with: Cursor
2026-04-08 19:36:49 +02:00
rick 86d9a9da79 Add backend worker, bootstrap, and tests (sections 11-13)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
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
2026-04-08 19:21:08 +02:00
rick e25e54b98a Fix dev-mode auth: auto-authenticate on /api/auth/me
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
The auth/me endpoint was excluded from AuthMiddleware (as all /api/auth/
paths are), so dev-mode auto-auth never ran for it. Fixed by checking
DevMode config directly in the /me handler.

Also removed the aggressive window.location redirect from the API client
— the React router handles 401s via the RequireAuth wrapper instead.

Made-with: Cursor
2026-04-08 19:03:55 +02:00
rick 45f026b4f4 Add React frontend with live data pages (section 10)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
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
2026-04-08 18:32:03 +02:00
rick f74a15929a Add API Layer — REST endpoints serving real data (section 9)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
Full ASP.NET Core minimal API with 13 endpoint groups:
- Auth: login (session cookies), logout, me, password reset
- Accounts: CRUD for chart of accounts with budget owner
- Ledger: inspect with running balance, balance sheet, P&L, transactions
- Expense Claims: list, create (with VAT), attest, validate
- Invoices: inbound (with OOD), outbound (with VAT), attestation
- Payouts: list, create
- Crypto: treasury overview, addresses, UTXOs
- Documents: upload (multipart), download
- Dashboard: task groups, YTD P&L
- Organizations: list, get, update settings
- Users: CRUD, role assignment/removal
- End of Month: checklist, close year
- Dev: impersonation (disabled in production)

Tested live against migrated production data — all endpoints returning
correct financial data from the v6 database.

Made-with: Cursor
2026-04-08 18:26:42 +02:00
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 f9dbb889f9 Add Database Layer and Common/Basic types (sections 5-6)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
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
2026-04-08 16:38:59 +02:00
rick 40eefc6163 Add stored procedures, triggers, grants, and seed data (section 4)
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has started running
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
2026-04-08 16:28:33 +02:00
rick 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
2026-04-08 16:25:58 +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
rick 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
2026-04-08 16:02:58 +02:00
Rick Falkvinge 15a5a0ce76 Changing something to force a build 2024-10-07 13:10:37 +02:00
Rick Falkvinge dd137f6ce8 Changing something to force a build 2024-10-07 12:56:39 +02:00
Rick Falkvinge 63f78beb77 Also works better if the URI is unescaped 2024-10-07 12:43:16 +02:00
Rick Falkvinge 36cf5d229e Works better if you spell URI correctly 2024-10-07 12:33:18 +02:00
Rick Falkvinge b85b0692f1 Works better if you spell URI correctly 2024-10-07 12:24:50 +02:00
Rick Falkvinge 3116d213b8 Adapting QR code generation to run locally 2024-10-07 12:03:58 +02:00
Rick Falkvinge babc87041f Removed Google Charts for QR generation 2024-10-07 11:03:26 +02:00
Rick Falkvinge d73cc256c7 Fixed Postbank DE import 2023 2023-09-06 19:22:41 +02:00
Rick Falkvinge f1c5a9eea2 Forcing a build 2023-09-06 16:43:44 +02:00