askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
bank_lines.json · 4.0 KB · 50 lines
| 1 | { |
| 2 | "name": "bank_lines", |
| 3 | "title": "Bank Lines", |
| 4 | "version": 1, |
| 5 | "storage": "append", |
| 6 | "description": "Imported statement lines -- the independent third-party record the books are checked against, and the reason bank reconciliation is the #1 practical anti-fraud control. Append-only and never hand-edited: `raw` keeps the original row verbatim forever and the parsed fields are a VIEW of it, so nobody can quietly 'fix up' the evidence to agree with the books. amount_cents is signed (money into the account positive, out negative). Everything an operator DOES with a line -- matching it, resolving it as a fee or a transfer -- is a separate attributed update, so who reconciled what and when is structural, which matters because reconciliation performed invisibly by the same hands that move money is the classic fraud hole. hooks.before_write rejects duplicates within an account (external_id when the bank gives one, else line_hash).", |
| 7 | "hooks": {"before_write": "hook_bank_lines"}, |
| 8 | "fields": [ |
| 9 | {"name": "id"}, |
| 10 | {"name": "import_id", "label": "Import", |
| 11 | "relation": {"collection": "bank_statement_imports", "display_field": "period_end"}}, |
| 12 | {"name": "bank_account_id", "required": true, "label": "Bank Account", |
| 13 | "relation": {"collection": "value_accounts", "display_field": "name"}}, |
| 14 | {"name": "posted_on", "type": "date", "required": true, "label": "Posted"}, |
| 15 | {"name": "amount_cents", "type": "integer", "required": true, "label": "Amount (cents)", |
| 16 | "help": "Signed: positive is money into the account, negative is money out. Integer cents, never a float."}, |
| 17 | {"name": "description", "type": "text", "label": "Description"}, |
| 18 | {"name": "external_id", "type": "text", "label": "Bank Transaction ID", |
| 19 | "help": "The bank's own id (OFX FITID) when the format carries one -- the strongest dedup key."}, |
| 20 | {"name": "line_hash", "type": "text", "label": "Line Hash", |
| 21 | "help": "Content hash used for dedup when the bank gives no id; ordinal-disambiguated so genuine same-day twins both land."}, |
| 22 | {"name": "raw", "type": "textarea", "label": "Raw Row", |
| 23 | "help": "The original statement row, verbatim. Never rewritten -- this is the evidence."}, |
| 24 | {"name": "match_status", "type": "enum", "default": "unmatched", "label": "Match Status", |
| 25 | "enum": ["unmatched", "suggested", "matched", "resolved"], |
| 26 | "transitions": { |
| 27 | "unmatched": ["suggested", "matched", "resolved"], |
| 28 | "suggested": ["matched", "unmatched", "resolved"], |
| 29 | "matched": ["unmatched", "resolved"], |
| 30 | "resolved": ["unmatched"] |
| 31 | }, |
| 32 | "help": "unmatched -> suggested (the matcher proposed something) -> matched (a human confirmed) or resolved (booked as a fee/interest/transfer/NSF/timing item). Every move is attributed."}, |
| 33 | {"name": "matched_to", "type": "text", "label": "Matched To", |
| 34 | "help": "collection/record_id of the book-side record this line is, e.g. payments/p1 or fin_journals/j9."}, |
| 35 | {"name": "resolved_as", "type": "enum", "label": "Resolved As", |
| 36 | "enum": ["fee", "interest", "transfer", "nsf", "timing", "other"], |
| 37 | "help": "For lines with no book counterpart yet: what the line actually was. Each has a resolution verb that composes the right journal."}, |
| 38 | {"name": "suggestions", "type": "textarea", "label": "Suggestions (JSON)", |
| 39 | "help": "What the matcher proposed and why (tier + candidates). Derived and non-authoritative -- a human confirmation is what writes matched_to."}, |
| 40 | {"name": "owner_id", "type": "text", "label": "Owner"}, |
| 41 | {"name": "entity_id", "type": "text", "label": "Entity", |
| 42 | "relation": {"collection": "entities", "display_field": "name"}}, |
| 43 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Imported"} |
| 44 | ], |
| 45 | "search": {"fields": ["description", "external_id"]}, |
| 46 | "forms": {"default": {"fields": ["bank_account_id", "posted_on", "amount_cents", "description"]}}, |
| 47 | "views": {"list_mode": "table", |
| 48 | "list_fields": ["posted_on", "description", "amount_cents", "match_status", "resolved_as"], |
| 49 | "filter_fields": ["bank_account_id", "match_status", "resolved_as"]} |
| 50 | } |