Every unit moves through fixed states: occupied, notice given, vacating, turnover in progress, inspection pending, ready to list, listed, reserved, and leased. Any other move is refused. A unit cannot go from turnover to listed without a passed inspection record.
- Each state change and its event is saved in one PostgreSQL transaction through a transactional outbox
- A relay publishes outbox events to BullMQ queues, so no alert goes out for a change that failed to save
- Exclusion constraint on unit and lease dates, which blocks two active leases on one unit
- Lease end dates read from the Ejar record instead of a PDF