Commit 1092d51
feat: accounting ledgers, house accounts, groups/allotment, reservation ops + AI (#102)
* chore: harden .gitignore for private research/planning artifacts
Add patterns so private domain/research planning files can never be
accidentally tracked, alongside the existing proprietary kb/ and briefs/
exclusions.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* feat(accounting): deposit ledger, A/R, cash drawer, trial balance, GL codes
Add a Tier-1 accounting layer that makes HAIP financials correct by
construction:
- Deposit Ledger: advance deposits tracked as a liability with a full
held -> applied/refunded/forfeited recognition lifecycle
- Accounts Receivable: named A/R ledgers, folio->A/R transfer-to-zero,
audit-safe reverse transfers, A/R payments, aging buckets
- Cash Drawer & cashiering: drawers, shift sessions, cash movements,
shift close with expected-vs-counted variance, cashier report
- Daily Trial Balance report across deposit/guest/A/R ledgers
- Custom transaction + GL accounting codes
New accounting + cashier NestJS modules; 4 schema files (+7 tables,
6 enums) with idempotent migrations; 11 new webhook events (48 total);
27 new endpoints (~125 total). 605 tests across 50 files, all passing.
All new tables enforce property_id multi-tenancy; money via decimal.js.
Updates README and adds CHANGELOG.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* feat(agent): T1 AI hooks — A/R collections agent, cash-variance + deposit-risk
Layer AI onto the new accounting features:
- A/R Collections Prioritization agent (new agent_type 'ar_collections'):
ranks open A/R ledgers by balance x days-overdue x open-transfer count
into low/medium/high tiers with a recommended collections action
- Night Audit Anomaly agent: new 'cash_variance_outlier' anomaly type —
flags over/short variances on closed cashier shifts (11 types total)
- Cancellation Prediction agent: additive deposit-forfeit risk scoring on
held deposits (likely-forfeit vs likely-refund exposure)
Adds agent_type enum values 'ar_collections' and 'deposit_risk' with
idempotent ALTER TYPE migrations. 10 built-in agents now (was 9).
624 tests across 51 files, all passing. Updates README + CHANGELOG.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* feat(folio): house accounts, split-folio routing, payment correction matrix
Tier 2 — extend the billing layer:
- House Accounts: non-guest ledger (walk-in retail, bar, vendor, internal)
with open/close lifecycle and a products catalog; charges/payments share
the unified ledger via a nullable house_account_id (folio_id now nullable —
a ledger row belongs to either a folio or a house account)
- Split Folio: config-driven routing rules + move-transactions between
folios (by id or charge type); night-audit-locked charges protected
- Payment Correction Matrix: correctPayment() enforces void (uncaptured
auth / same-day cash) vs refund (captured card) vs compensating adjustment;
illegal overrides rejected
New house-account NestJS module; 3 new tables (house_accounts, products,
folio_routing_rules), 3 enums; 7 new webhook events (55 total); 15 new
endpoints (~140 total). 643 tests across 53 files, all passing. All new
tables enforce property_id; money via decimal.js. Updates README + CHANGELOG.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* feat(groups): allotment blocks, pickup, rooming lists, group folio + AI
Tier 3 — Groups & Allotment engine (largest net-new surface):
- Group profiles (corporate/TA/wholesale/event) with optional master/group
folio and computed group invoices
- Allotment blocks: per-date/room-type inventory validated against live
availability (no over-allotment), cutoff/shoulder dates, Min/Max LOS
- Cutoff & auto-release: per-block release + process-cutoffs sweep that frees
unsold rooms back to general inventory (endpoint-triggered, no cron lib)
- Pickup tracking (allotted vs picked up per date/room-type)
- Rooming-list batch import: creates+links member reservations, per-row
success/error, increments pickup
- Group Pickup Forecasting agent (new agent_type group_pickup): projects
pickup vs wash, recommends hold/partial-release/full-release
New groups NestJS module; 4 tables + reservations.group_profile_id; 3 enums;
6 webhook events (61 total); 16 endpoints (~155 total); 11 agents now.
672 tests across 57 files, all passing. All tables enforce property_id;
linkReservation scoped by request propertyId (no confused-deputy).
Updates README + CHANGELOG.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* feat(reservation): notes, bulk actions, messaging, unassigned finder, import
Tier 4 — reservation operations polish:
- Bulk actions: multi check-in/out/cancel with per-id success/error results
- Reservation notes with active-count tracking
- Guest messaging from a reservation (GDPR marketing opt-out enforced)
- Unassigned-reservation finder (confirmed/assigned, no room, date window)
- Batch reservation import with per-row error handling
Deliberately NOT implemented: reservation status reversion ('un-cancel') —
a payment-integrity hazard per KB 14.8; enforced by a regression test and a
code comment. Create a new reservation instead.
New reservation_notes table; 3 webhook events (64 total); 8 endpoints
(~165 total). All within the reservation module; EmailService wired locally.
691 tests across 61 files, all passing. All new queries enforce property_id.
Updates README + CHANGELOG.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
* docs(changelog): note automated versioning, correct baseline to v1.2.5
The release workflow assigns version numbers/tags on merge, so the
CHANGELOG keeps an [Unreleased] section and points the prior baseline at
the real git-tag history (v1.0.0 → v1.2.5) instead of a placeholder.
https://claude.ai/code/session_01Jq85xVJDW1NpvxQrnEdFdt
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c2de47b commit 1092d51
113 files changed
Lines changed: 10193 additions & 41 deletions
File tree
- apps/api/src
- modules
- accounting
- dto
- agent
- ar-collections
- cancellation
- group-pickup
- night-audit
- cashier
- dto
- folio
- dto
- groups
- dto
- house-account
- dto
- payment
- dto
- reports
- reservation
- dto
- packages
- database/src
- schema
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
0 commit comments