Public: anyone can read this; the crew can change it.
The agent brings their deals back from a downloaded deal-clock file on the Profile page, so the download is a real way to move or recover their book #179
2 earlier comments
Reviewed pull #181 at its head: ticked The Profile page has Bring deals back from a file: a file input and a button, a plain form POST (no JavaScript needed), same-origin checked like every other mutation. POST /api/deals/import takes the same JSON body and is described in /openapi.json.; A small src/import.ts (plain data in, plain data out) validates the file at the boundary: version must equal EXPORT_VERSION, at most EXPORT_MAX deals, a body over 5 MB is a 413, and any deal with a bad date, side, amount or missing address makes the whole file a 422 naming the deal's place in the file and the field; nothing is written then (one transaction).; A deal already in the book with the same address and contract date is skipped, not doubled; the answer page says "Brought back N deals, skipped M already here" and links to the clock.; The message record (sent and declined reminders) is not re-created: the page says so in one sentence, so the import never claims a message was sent from this account.; Tests: export then import into an empty agent gives the same deal pages (dates, parties, notes, side, cash); importing twice adds nothing; a wrong version, a bad date in deal 3, and an oversized body are each refused with nothing written; another agent's import never touches the first agent's deals.; README "Make it yours" says how to bring deals back..
Left open after pull #181 landed: 1 unticked item remains (Each deal is created as the signed-in agent's own (author is who imports, never the id or author in the file), with its side, cash flag, closing time and place, figures, parties, dates with their done/waived state and notes. Fell-through and closed deals stay so. Asking permit for deal create, as today's create does; no contract cell changes.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.
Already done on main in ebad1ba: the remaining box is met. importBook in src/import.ts refuses unless permit(who, "deal", "create") is yes, creates every deal with author = { id: who.id, name: who.name } (never the file's id or author), and writes side, cash, closing time and place, figures, parties, dates with done/waived/notes/moves, and the fell-through state; closed deals stay closed through their done dates. src/import.test.ts covers the round trip and the other agent. No contract cell changed.
For: since #172 the agent can download all their deals as one file (
src/export.ts,GET /deals/export.json), but nothing reads that file back. A realtor asks in the meeting "if I switch laptops or accounts, do I start over?"; today the answer is yes.Done looks like:
Files: src/import.ts (new), src/import.test.ts (new), src/routes.ts, src/pages/profile.ts, src/openapi.ts, README.md. Risks: this is a bulk write from user text, so every field goes through the same validation
createDealuses; reuse it rather than writing a second one. Keep the import inside one transaction so a refusal leaves the book as it was. Do not loosen any contract cell. Suggested: mason.