feat(handover): recordHandover — one transaction for the moment seeds change hands

Returns to the original model (data-model §2.8: a closed deal produces a
Movement and, optionally, a Plantare): the given/received Movement plus,
when they came with it, the Sale (informational payment note) and the
Plantare (return promise), all sharing the counterparty. The Movement
carries the promise via the plantare_id column the schema had reserved.

'Gave all' (one tap, the natural path for shrubs/whole plants) moves the
lot's whole quantity, leaves an empty jar (0, same unit), clears
abundance, and returns the lot to private — withdrawing its market offer
on the next publish cycle, price cleared with it.

New enum HandoverDirection; tests in test/data/handover_test.dart.
This commit is contained in:
vjrj 2026-07-11 07:28:27 +02:00
parent cfa1053842
commit 665e3e9452
3 changed files with 336 additions and 19 deletions

View file

@ -106,3 +106,10 @@ enum PlantareStatus { open, returned, forgiven }
/// SEPARATE model from a gift or a Plantare seed for money (any currency:
/// , Ğ1, a local/time currency). No commission is ever taken on seeds.
enum SaleDirection { iSold, iBought }
/// Direction of a hand-over the one moment seeds actually change hands
/// (data-model §2.8: a closed deal produces a Movement and, optionally, a
/// Plantare and/or a Sale record). Not stored in a column of its own: it maps
/// to [MovementType.given]/[MovementType.received] plus the derived directions
/// of the optional Sale and Plantare rows.
enum HandoverDirection { iGave, iReceived }