Public: anyone can read this; the crew can change it.
Thirty days after a deal closes, the agent gets a drafted "How is the new home?" check-in to their clients, approved like any reminder, so past clients turn into referrals #156
Check · Review · Land · Live done — Landed and live in production.
mason/deal-clock:mason/139-thirty-days-after-a-deal-closes-the-agen → main 2 commits fork 1 thread · 1 unresolved
14 files
changed +322
−37
README.md +3
| @@ -155,6 +155,9 @@ Signed out, `/` shows what deal-clock does, three short points, a still picture | ||
| 155 | 155 | mark it done. The deal steps off the clock into the Closed card below it, |
| 156 | 156 | its reminders stop, and its page says "Closed on …". Everything on it still |
| 157 | 157 | opens; reopen the Closing date and the deal is back on the clock. |
| 158 | A month after you marked it done, a drafted "How is the new home?" check-in | |
| 159 | to your past clients (the buyers, the sellers, or both, by the deal's side) | |
| 160 | waits in Review and the header count; send, edit, hold or decline it like any reminder. | |
| 158 | 161 | 12. **Download the calendar file.** On a deal's page, tap Add to calendar. |
| 159 | 162 | You get a calendar file with every date of the deal and two |
| 160 | 163 | alarms for each: one as many days ahead as that date's Reminds N days |
contract/openapi.json +22 −12
| @@ -253,11 +253,11 @@ | ||
| 253 | 253 | }, |
| 254 | 254 | "/tick": { |
| 255 | 255 | "post": { |
| 256 | "summary": "The reminders that go out today and have not been sent: call it each morning. It sends nothing and changes nothing.", | |
| 256 | "summary": "The reminders that go out today and have not been sent, including the check-in (moment checkin) owed to past clients 30 days after a closing was marked done: call it each morning. It sends nothing and changes nothing.", | |
| 257 | 257 | "operationId": "postTick", |
| 258 | 258 | "responses": { |
| 259 | 259 | "200": { |
| 260 | "description": "The reminders that go out today and have not been sent: call it each morning. It sends nothing and changes nothing.", | |
| 260 | "description": "The reminders that go out today and have not been sent, including the check-in (moment checkin) owed to past clients 30 days after a closing was marked done: call it each morning. It sends nothing and changes nothing.", | |
| 261 | 261 | "content": { |
| 262 | 262 | "application/json": { |
| 263 | 263 | "schema": { |
| @@ -1074,7 +1074,8 @@ | ||
| 1074 | 1074 | "day_of", |
| 1075 | 1075 | "late", |
| 1076 | 1076 | "moved", |
| 1077 | "status" | |
| 1077 | "status", | |
| 1078 | "checkin" | |
| 1078 | 1079 | ] |
| 1079 | 1080 | }, |
| 1080 | 1081 | "due": { |
| @@ -1126,7 +1127,8 @@ | ||
| 1126 | 1127 | "day_of", |
| 1127 | 1128 | "late", |
| 1128 | 1129 | "moved", |
| 1129 | "status" | |
| 1130 | "status", | |
| 1131 | "checkin" | |
| 1130 | 1132 | ] |
| 1131 | 1133 | }, |
| 1132 | 1134 | "due": { |
| @@ -1728,7 +1730,8 @@ | ||
| 1728 | 1730 | "day_of", |
| 1729 | 1731 | "late", |
| 1730 | 1732 | "moved", |
| 1731 | "status" | |
| 1733 | "status", | |
| 1734 | "checkin" | |
| 1732 | 1735 | ] |
| 1733 | 1736 | }, |
| 1734 | 1737 | "reason": { |
| @@ -1823,7 +1826,8 @@ | ||
| 1823 | 1826 | "before", |
| 1824 | 1827 | "day_of", |
| 1825 | 1828 | "late", |
| 1826 | "moved" | |
| 1829 | "moved", | |
| 1830 | "checkin" | |
| 1827 | 1831 | ] |
| 1828 | 1832 | }, |
| 1829 | 1833 | "subject": { |
| @@ -1920,7 +1924,8 @@ | ||
| 1920 | 1924 | "before", |
| 1921 | 1925 | "day_of", |
| 1922 | 1926 | "late", |
| 1923 | "moved" | |
| 1927 | "moved", | |
| 1928 | "checkin" | |
| 1924 | 1929 | ] |
| 1925 | 1930 | } |
| 1926 | 1931 | }, |
| @@ -2003,7 +2008,8 @@ | ||
| 2003 | 2008 | "day_of", |
| 2004 | 2009 | "late", |
| 2005 | 2010 | "moved", |
| 2006 | "status" | |
| 2011 | "status", | |
| 2012 | "checkin" | |
| 2007 | 2013 | ] |
| 2008 | 2014 | } |
| 2009 | 2015 | }, |
| @@ -3062,7 +3068,8 @@ | ||
| 3062 | 3068 | "day_of", |
| 3063 | 3069 | "late", |
| 3064 | 3070 | "moved", |
| 3065 | "status" | |
| 3071 | "status", | |
| 3072 | "checkin" | |
| 3066 | 3073 | ] |
| 3067 | 3074 | }, |
| 3068 | 3075 | "due": { |
| @@ -3114,7 +3121,8 @@ | ||
| 3114 | 3121 | "day_of", |
| 3115 | 3122 | "late", |
| 3116 | 3123 | "moved", |
| 3117 | "status" | |
| 3124 | "status", | |
| 3125 | "checkin" | |
| 3118 | 3126 | ] |
| 3119 | 3127 | }, |
| 3120 | 3128 | "due": { |
| @@ -3214,8 +3222,10 @@ | ||
| 3214 | 3222 | "day_of", |
| 3215 | 3223 | "late", |
| 3216 | 3224 | "moved", |
| 3217 | "status" | |
| 3218 | ] | |
| 3225 | "status", | |
| 3226 | "checkin" | |
| 3227 | ], | |
| 3228 | "description": "Why it goes out. checkin is the \"How is the new home?\" message to a past client 30 days after the deal's closing was marked done (buyers on a buyer-side deal, sellers on a listing, both on a both-sides deal); it hangs on the closing's deadline_id, its due is the day the closing was marked done, and a reopened or fell-through deal has none." | |
| 3219 | 3229 | }, |
| 3220 | 3230 | "on": { |
| 3221 | 3231 | "type": "string", |
docs/TECHNICAL.md +7
| @@ -31,6 +31,13 @@ drafts no reminders, follow-up, business-day flag or after-closing conflict. | ||
| 31 | 31 | the MCP tool `waive_date` and `W` in the terminal all call `waiveDate`, an |
| 32 | 32 | update of the deal, audited as `date.waive`. |
| 33 | 33 | |
| 34 | A closed deal drafts one check-in (`moment: "checkin"`, `src/checkin.ts`) per | |
| 35 | client party with a contact (buyers on a buyer-side deal, sellers on a listing, | |
| 36 | both on a both-sides deal), on the morning 30 days after the day the closing | |
| 37 | was marked done. It hangs on the closing's `deadline_id`, is keyed by that day | |
| 38 | (so reopening and closing again is a new one), and is sent, held, declined and | |
| 39 | listed in `/tick` like any reminder. A reopened or fell-through deal has none. | |
| 40 | ||
| 34 | 41 | A deal that falls through has `fell_at`, `fell_reason` and `fell_by` set |
| 35 | 42 | (`deal.fell_through` in the JSON of `GET /api/deals`); `closed` keeps meaning |
| 36 | 43 | "Closing marked done". It is off the clock like a closed deal: no reminders, |
src/checkin.test.ts added +95
| @@ -0,0 +1,95 @@ | ||
| 1 | /** A month after a closing is marked done, each past client is owed a check-in, approved like any reminder. */ | |
| 2 | import { expect, test } from "bun:test"; | |
| 3 | import { mkdtempSync } from "node:fs"; | |
| 4 | import { tmpdir } from "node:os"; | |
| 5 | import { join } from "node:path"; | |
| 6 | import { createDeal, declineReminder, getDeal, holdReminder, markDone, sendReminder, listDeals } from "./deals.ts"; | |
| 7 | import { openDb } from "./db.ts"; | |
| 8 | import { checkinDrafts, dueOn, todaysDrafts, waitingCount, unsent } from "./reminders.ts"; | |
| 9 | import { dealPage } from "./pages/deal.ts"; | |
| 10 | import type { Who } from "./who.ts"; | |
| 11 | ||
| 12 | const alice: Who = { role: "user", id: "u1", name: "alice" }; | |
| 13 | const dana = { name: "Dana", brokerage: "HP", phone: "(555) 010-0142", email: "[email protected]" }; | |
| 14 | const db = openDb(mkdtempSync(join(tmpdir(), "app-checkin-"))); | |
| 15 | ||
| 16 | function closed(address: string, side: string, doneOn = "2026-10-01") { | |
| 17 | const made = createDeal(db, alice, { openAnyway: true, address, buyer: "Ann Buyer", seller: "Sam Seller", contractDate: "2026-09-01", closingDate: "2026-10-01", side, salePrice: 612000 }); | |
| 18 | if (!made.ok) throw new Error(made.message); | |
| 19 | db.query("UPDATE party SET email = lower(substr(name, 1, 3)) || '@example.com', contact = lower(substr(name, 1, 3)) || '@example.com' WHERE deal_id = ?1").run(made.value.id); | |
| 20 | const closing = getDeal(db, alice, { id: made.value.id }).value!.deadlines.find((d) => d.kind === "closing")!; | |
| 21 | markDone(db, alice, { id: closing.id, done: true }); | |
| 22 | db.query("UPDATE deadline SET done_at = ?1 WHERE id = ?2").run(`${doneOn}T12:00:00.000Z`, closing.id); | |
| 23 | return { id: made.value.id, closing: closing.id }; | |
| 24 | } | |
| 25 | const view = (id: number) => getDeal(db, alice, { id }).value!; | |
| 26 | const all = () => listDeals(db, alice).value!; | |
| 27 | ||
| 28 | test("drafted on day 30 and not day 29, once per client the side names", () => { | |
| 29 | const buyer = closed("1 Buyer Side", "buyer"); | |
| 30 | const listing = closed("2 Listing", "listing"); | |
| 31 | const both = closed("3 Both", "both"); | |
| 32 | const who = (id: number) => checkinDrafts(view(id), dana).map((d) => d.party_role); | |
| 33 | expect(who(buyer.id)).toEqual(["buyer"]); | |
| 34 | expect(who(listing.id)).toEqual(["seller"]); | |
| 35 | expect(who(both.id)).toEqual(["buyer", "seller"]); | |
| 36 | const mine = (day: string) => todaysDrafts(all(), day, dana).filter((d) => d.moment === "checkin"); | |
| 37 | expect(mine("2026-10-30")).toEqual([]); | |
| 38 | expect(mine("2026-10-31").map((d) => d.address).sort()).toEqual(["1 Buyer Side", "2 Listing", "3 Both", "3 Both"]); | |
| 39 | expect(dueOn(all(), "2026-10-31", dana).filter((d) => d.moment === "checkin")).toHaveLength(4); | |
| 40 | expect(waitingCount(all(), "2026-10-31", dana)).toBe(4); | |
| 41 | expect(waitingCount(all(), "2026-10-30", dana)).toBe(0); | |
| 42 | }); | |
| 43 | ||
| 44 | test("the words are warm, name the address and never the price", () => { | |
| 45 | const d = checkinDrafts(view(closed("4 Words Lane", "buyer").id), dana)[0]!; | |
| 46 | expect(d.subject).toContain("4 Words Lane"); | |
| 47 | expect(d.body).toContain("Hi Ann,"); | |
| 48 | expect(d.body).toContain("how the move went"); | |
| 49 | expect(d.body).toContain("No pressure"); | |
| 50 | expect(d.body).not.toMatch(/612|\$/); | |
| 51 | expect(d.body.endsWith("\n\nDana, HP\n(555) 010-0142 · [email protected]")).toBe(true); | |
| 52 | }); | |
| 53 | ||
| 54 | test("a reopened deal and a fell-through deal get none", () => { | |
| 55 | const a = closed("5 Reopened", "buyer"); | |
| 56 | expect(checkinDrafts(view(a.id), dana)).toHaveLength(1); | |
| 57 | markDone(db, alice, { id: a.closing, done: false }); | |
| 58 | expect(checkinDrafts(view(a.id), dana)).toEqual([]); | |
| 59 | expect(todaysDrafts(all(), "2026-10-31", dana).filter((d) => d.address === "5 Reopened" && d.moment === "checkin")).toEqual([]); | |
| 60 | const b = closed("6 Fell", "buyer"); | |
| 61 | db.query("UPDATE deal SET fell_at = '2026-10-05T00:00:00.000Z', fell_reason = 'x' WHERE id = ?1").run(b.id); | |
| 62 | expect(checkinDrafts(view(b.id), dana)).toEqual([]); | |
| 63 | }); | |
| 64 | ||
| 65 | test("sending records the approved words; sent, it is not offered again", () => { | |
| 66 | const c = closed("7 Sent", "buyer"); | |
| 67 | const d = checkinDrafts(view(c.id), dana)[0]!; | |
| 68 | const sent = sendReminder(db, alice, { deadlineId: c.closing, partyId: d.party_id, moment: "checkin", body: "Hi Ann, how is it?", agent: dana }); | |
| 69 | expect(sent).toMatchObject({ ok: true, value: { moment: "checkin", body: "Hi Ann, how is it?" } }); | |
| 70 | const after = checkinDrafts(view(c.id), dana)[0]!; | |
| 71 | expect(after.sent_at).not.toBeNull(); | |
| 72 | expect(after.body).toBe("Hi Ann, how is it?"); | |
| 73 | expect(todaysDrafts(all(), "2026-10-31", dana).filter(unsent).some((x) => x.address === "7 Sent")).toBe(false); | |
| 74 | expect(view(c.id).sent[0]).toMatchObject({ moment: "checkin", body: "Hi Ann, how is it?" }); | |
| 75 | expect(dealPage({ who: alice, deal: view(c.id), on: "2026-10-31" })).toContain("Check-in"); | |
| 76 | }); | |
| 77 | ||
| 78 | test("the deal page offers the check-in on day 30, not before", () => { | |
| 79 | const c = closed("10 Early", "buyer"); | |
| 80 | expect(dealPage({ who: alice, deal: view(c.id), on: "2026-10-30" })).not.toContain("Check-in"); | |
| 81 | expect(dealPage({ who: alice, deal: view(c.id), on: "2026-10-31" })).toContain("Check-in"); | |
| 82 | }); | |
| 83 | ||
| 84 | test("declining stops it; holding moves it to tomorrow", () => { | |
| 85 | const c = closed("8 Declined", "buyer"); | |
| 86 | const d = checkinDrafts(view(c.id), dana)[0]!; | |
| 87 | expect(declineReminder(db, alice, { deadlineId: c.closing, partyId: d.party_id, moment: "checkin", reason: "Moved abroad", agent: dana }).ok).toBe(true); | |
| 88 | expect(todaysDrafts(all(), "2026-10-31", dana).some((x) => x.address === "8 Declined" && unsent(x))).toBe(false); | |
| 89 | const h = closed("9 Held", "buyer"); | |
| 90 | const hd = checkinDrafts(view(h.id), dana)[0]!; | |
| 91 | expect(holdReminder(db, alice, { deadlineId: h.closing, partyId: hd.party_id, moment: "checkin", on: "2026-10-31", agent: dana }).ok).toBe(true); | |
| 92 | const mine = (day: string) => todaysDrafts(all(), day, dana).filter((x) => x.address === "9 Held" && unsent(x)); | |
| 93 | expect(mine("2026-10-31")).toEqual([]); | |
| 94 | expect(mine("2026-11-01")).toHaveLength(1); | |
| 95 | }); |
src/checkin.ts added +28
| @@ -0,0 +1,28 @@ | ||
| 1 | /** | |
| 2 | * The check-in: a month after a closing is marked done, each past client | |
| 3 | * gets a short, warm "How is the new home?" draft. This module holds the day | |
| 4 | * it goes out, who it goes to and the words; `reminders.ts` makes the draft. | |
| 5 | */ | |
| 6 | ||
| 7 | import { addDays } from "./dates.ts"; | |
| 8 | import type { PartyRole } from "./deadlines.ts"; | |
| 9 | import type { Side } from "./side.ts"; | |
| 10 | ||
| 11 | /** Days after the closing was marked done that the check-in goes out. */ | |
| 12 | export const CHECKIN_DAYS = 30; | |
| 13 | ||
| 14 | /** The morning the check-in goes out, given the day the closing was marked done. */ | |
| 15 | export const checkinOn = (doneOn: string): string => addDays(doneOn, CHECKIN_DAYS); | |
| 16 | ||
| 17 | /** The client parties a deal's side checks in on: the buyers, the sellers, or both. */ | |
| 18 | export function checkinRoles(side: Side): readonly PartyRole[] { | |
| 19 | return side === "buyer" ? ["buyer"] : side === "listing" ? ["seller"] : ["buyer", "seller"]; | |
| 20 | } | |
| 21 | ||
| 22 | /** The words of a check-in to one client; never the price. `signOff` is the agent's usual ending. */ | |
| 23 | export function checkinWords(address: string, firstName: string, signOff: string): { subject: string; body: string } { | |
| 24 | return { | |
| 25 | subject: `How is the new home? — ${address}`, | |
| 26 | body: `Hi ${firstName}, it has been about a month since ${address}, and I wanted to ask how the move went. Is the home treating you well?\n\nIf anything has come up since closing, I'm happy to help with it, whether that's a question about the paperwork or a good name for a plumber.\n\nAnd if you know someone thinking of buying or selling, I'd be glad to look after them the way I looked after you. No pressure at all; I'm just glad to have been part of it.\n\n${signOff}`, | |
| 27 | }; | |
| 28 | } |
src/db.ts +66
| @@ -433,6 +433,72 @@ export const migrations: string[] = [ | ||
| 433 | 433 | // Repair: the Profile-line change inserted the profile line mid-list, so databases already past |
| 434 | 434 | // that position never got it. Tolerated as a duplicate where it exists. |
| 435 | 435 | `ALTER TABLE profile ADD COLUMN line TEXT NOT NULL DEFAULT '' CHECK (length(line) <= 200)`, |
| 436 | // A check-in a month after a closing is a sixth moment, `checkin`. SQLite cannot alter a | |
| 437 | // CHECK, so the three tables that hold a moment are rebuilt as before. | |
| 438 | `CREATE TABLE reminder_new ( | |
| 439 | id INTEGER PRIMARY KEY, | |
| 440 | deal_id INTEGER NOT NULL REFERENCES deal (id) ON DELETE CASCADE, | |
| 441 | deadline_id INTEGER NOT NULL, | |
| 442 | party_id INTEGER NOT NULL, | |
| 443 | label TEXT NOT NULL, | |
| 444 | party_name TEXT NOT NULL, | |
| 445 | moment TEXT NOT NULL CHECK (moment IN ('before', 'day_of', 'late', 'moved', 'status', 'checkin')), | |
| 446 | due TEXT NOT NULL, | |
| 447 | by_name TEXT NOT NULL, | |
| 448 | subject TEXT NOT NULL DEFAULT '', | |
| 449 | body TEXT NOT NULL DEFAULT '', | |
| 450 | sent_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')), | |
| 451 | party_role TEXT NOT NULL DEFAULT '', | |
| 452 | sample INTEGER NOT NULL DEFAULT 0, | |
| 453 | move_id INTEGER NOT NULL DEFAULT 0, | |
| 454 | UNIQUE (deadline_id, party_id, moment, due, move_id) | |
| 455 | ); | |
| 456 | INSERT INTO reminder_new (id, deal_id, deadline_id, party_id, label, party_name, moment, due, by_name, subject, body, sent_at, party_role, sample, move_id) | |
| 457 | SELECT id, deal_id, deadline_id, party_id, label, party_name, moment, due, by_name, subject, body, sent_at, party_role, sample, move_id FROM reminder; | |
| 458 | DROP TABLE reminder; | |
| 459 | ALTER TABLE reminder_new RENAME TO reminder; | |
| 460 | CREATE INDEX reminder_deal ON reminder (deal_id); | |
| 461 | CREATE TABLE reminder_declined_new ( | |
| 462 | id INTEGER PRIMARY KEY, | |
| 463 | deal_id INTEGER NOT NULL REFERENCES deal (id) ON DELETE CASCADE, | |
| 464 | deadline_id INTEGER NOT NULL, | |
| 465 | party_id INTEGER NOT NULL, | |
| 466 | label TEXT NOT NULL, | |
| 467 | party_name TEXT NOT NULL, | |
| 468 | moment TEXT NOT NULL CHECK (moment IN ('before', 'day_of', 'late', 'moved', 'status', 'checkin')), | |
| 469 | due TEXT NOT NULL, | |
| 470 | reason TEXT NOT NULL CHECK (length(reason) BETWEEN 1 AND 200), | |
| 471 | by_name TEXT NOT NULL, | |
| 472 | at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')), | |
| 473 | move_id INTEGER NOT NULL DEFAULT 0, | |
| 474 | UNIQUE (deadline_id, party_id, moment, due, move_id) | |
| 475 | ); | |
| 476 | INSERT INTO reminder_declined_new (id, deal_id, deadline_id, party_id, label, party_name, moment, due, reason, by_name, at, move_id) | |
| 477 | SELECT id, deal_id, deadline_id, party_id, label, party_name, moment, due, reason, by_name, at, move_id FROM reminder_declined; | |
| 478 | DROP TABLE reminder_declined; | |
| 479 | ALTER TABLE reminder_declined_new RENAME TO reminder_declined; | |
| 480 | CREATE INDEX reminder_declined_deal ON reminder_declined (deal_id); | |
| 481 | CREATE TABLE reminder_hold_new ( | |
| 482 | id INTEGER PRIMARY KEY, | |
| 483 | deal_id INTEGER NOT NULL REFERENCES deal (id) ON DELETE CASCADE, | |
| 484 | deadline_id INTEGER NOT NULL, | |
| 485 | party_id INTEGER NOT NULL, | |
| 486 | moment TEXT NOT NULL CHECK (moment IN ('before', 'day_of', 'late', 'moved', 'checkin')), | |
| 487 | due TEXT NOT NULL, | |
| 488 | move_id INTEGER NOT NULL DEFAULT 0, | |
| 489 | until TEXT NOT NULL, | |
| 490 | held_on TEXT NOT NULL, | |
| 491 | by_name TEXT NOT NULL, | |
| 492 | at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')), | |
| 493 | subject TEXT NOT NULL DEFAULT '', | |
| 494 | body TEXT NOT NULL DEFAULT '', | |
| 495 | UNIQUE (deadline_id, party_id, moment, due, move_id) | |
| 496 | ); | |
| 497 | INSERT INTO reminder_hold_new (id, deal_id, deadline_id, party_id, moment, due, move_id, until, held_on, by_name, at, subject, body) | |
| 498 | SELECT id, deal_id, deadline_id, party_id, moment, due, move_id, until, held_on, by_name, at, subject, body FROM reminder_hold; | |
| 499 | DROP TABLE reminder_hold; | |
| 500 | ALTER TABLE reminder_hold_new RENAME TO reminder_hold; | |
| 501 | CREATE INDEX reminder_hold_deal ON reminder_hold (deal_id)`, | |
| 436 | 502 | ]; |
| 437 | 503 | |
| 438 | 504 | export function openDb(dir = dataDir): Database { |
src/deals.ts +4 −4
| @@ -198,9 +198,9 @@ export interface DealView extends Deal { | ||
| 198 | 198 | readonly conflicts: readonly Conflict[]; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | export type Moment = "before" | "day_of" | "late" | "moved" | "status"; | |
| 201 | export type Moment = "before" | "day_of" | "late" | "moved" | "status" | "checkin"; | |
| 202 | 202 | export const isMoment = (v: unknown): v is Moment => |
| 203 | v === "before" || v === "day_of" || v === "late" || v === "moved" || v === "status"; | |
| 203 | v === "before" || v === "day_of" || v === "late" || v === "moved" || v === "status" || v === "checkin"; | |
| 204 | 204 | |
| 205 | 205 | /** Text from a person: trimmed, one line, within bounds — or undefined. */ |
| 206 | 206 | export function line(value: unknown, min: number, max: number): string | undefined { |
| @@ -1197,7 +1197,7 @@ export function sendReminder( | ||
| 1197 | 1197 | const { dealId, found } = deadlineFor(db, who, input.deadlineId); |
| 1198 | 1198 | if (!found.ok) return within(db, who, "reminder.send", dealId, found); |
| 1199 | 1199 | if (!isMoment(input.moment)) |
| 1200 | return within(db, who, "reminder.send", dealId, fail("invalid", "A reminder is for ahead of a date, the day of, the day after (overdue), a date that changed, or a status update.")); | |
| 1200 | return within(db, who, "reminder.send", dealId, fail("invalid", "A reminder is for ahead of a date, the day of, the day after (overdue), a date that changed, a status update, or a check-in.")); | |
| 1201 | 1201 | const party = Number.isInteger(input.partyId) |
| 1202 | 1202 | ? db |
| 1203 | 1203 | .query<Party, [number, number]>("SELECT * FROM party WHERE id = ?1 AND deal_id = ?2") |
| @@ -1258,7 +1258,7 @@ function draftOf( | ||
| 1258 | 1258 | const { dealId, found } = deadlineFor(db, who, input.deadlineId, input.dealId); |
| 1259 | 1259 | if (!found.ok) return { dealId, found }; |
| 1260 | 1260 | if (!isMoment(input.moment)) |
| 1261 | return { dealId, found: fail("invalid", "A reminder is for ahead of a date, the day of, the day after (overdue), a date that changed, or a status update.") }; | |
| 1261 | return { dealId, found: fail("invalid", "A reminder is for ahead of a date, the day of, the day after (overdue), a date that changed, a status update, or a check-in.") }; | |
| 1262 | 1262 | const { deal, deadline } = found.value; |
| 1263 | 1263 | const party = Number.isInteger(input.partyId) |
| 1264 | 1264 | ? db.query<Party, [number, number]>("SELECT * FROM party WHERE id = ?1 AND deal_id = ?2").get(input.partyId, deal.id) |
src/mcp.ts +6 −6
| @@ -95,7 +95,7 @@ export const tools: readonly Tool[] = [ | ||
| 95 | 95 | }, |
| 96 | 96 | { |
| 97 | 97 | name: "reminders_today", |
| 98 | description: "The reminder drafts that go out today and have not been sent, including ones held from an earlier day that come back today.", | |
| 98 | description: "The reminder drafts that go out today and have not been sent, including ones held from an earlier day that come back today and the check-ins (moment checkin, on the closing's deadline_id) owed to past clients 30 days after a closing was marked done. Send, hold or decline them like any reminder; nothing goes without approval.", | |
| 99 | 99 | inputSchema: { type: "object", properties: {} }, |
| 100 | 100 | run: (db, who) => { |
| 101 | 101 | const deals = listDeals(db, who); |
| @@ -238,7 +238,7 @@ export const tools: readonly Tool[] = [ | ||
| 238 | 238 | properties: { |
| 239 | 239 | deadline_id: { type: "integer" }, |
| 240 | 240 | party_id: { type: "integer" }, |
| 241 | moment: { enum: ["before", "day_of", "late", "moved", "status"] }, | |
| 241 | moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] }, | |
| 242 | 242 | subject: { type: "string", minLength: 1, maxLength: 150 }, |
| 243 | 243 | body: { type: "string", minLength: 1, maxLength: 2000 }, |
| 244 | 244 | }, |
| @@ -280,7 +280,7 @@ export const tools: readonly Tool[] = [ | ||
| 280 | 280 | properties: { |
| 281 | 281 | deadline_id: { type: "integer" }, |
| 282 | 282 | party_id: { type: "integer" }, |
| 283 | moment: { enum: ["before", "day_of", "late", "moved", "status"] }, | |
| 283 | moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] }, | |
| 284 | 284 | reason: { type: "string", minLength: 1, maxLength: 200 }, |
| 285 | 285 | }, |
| 286 | 286 | required: ["deadline_id", "party_id", "moment", "reason"], |
| @@ -294,7 +294,7 @@ export const tools: readonly Tool[] = [ | ||
| 294 | 294 | "Hold a reminder until tomorrow, for a message the agent is not ready to approve: it leaves reminders_today and comes back the next morning with its words, labelled held. Give subject (up to 150 characters) and body (up to 2000) to hold the agent's edited words; leave them out to keep any already held. Held again, it waits one more day. A status update is not held.", |
| 295 | 295 | inputSchema: { |
| 296 | 296 | type: "object", |
| 297 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved"] }, subject: { type: "string" }, body: { type: "string" } }, | |
| 297 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "checkin"] }, subject: { type: "string" }, body: { type: "string" } }, | |
| 298 | 298 | required: ["deadline_id", "party_id", "moment"], |
| 299 | 299 | }, |
| 300 | 300 | run: (db, who, args) => |
| @@ -305,7 +305,7 @@ export const tools: readonly Tool[] = [ | ||
| 305 | 305 | description: "Bring a held reminder back to today, for when the agent is ready to send it after all: the hold is deleted and it returns to reminders_today. Refused when it is not held, or was already sent or declined.", |
| 306 | 306 | inputSchema: { |
| 307 | 307 | type: "object", |
| 308 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved"] } }, | |
| 308 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "checkin"] } }, | |
| 309 | 309 | required: ["deadline_id", "party_id", "moment"], |
| 310 | 310 | }, |
| 311 | 311 | run: (db, who, args) => |
| @@ -316,7 +316,7 @@ export const tools: readonly Tool[] = [ | ||
| 316 | 316 | description: "Take back a decline: the reminder is a draft again, to send or decline.", |
| 317 | 317 | inputSchema: { |
| 318 | 318 | type: "object", |
| 319 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status"] } }, | |
| 319 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] } }, | |
| 320 | 320 | required: ["deadline_id", "party_id", "moment"], |
| 321 | 321 | }, |
| 322 | 322 | run: (db, who, args) => |
src/migrations.pin.json +2 −1
| @@ -51,5 +51,6 @@ | ||
| 51 | 51 | "cf6972801626419644e27b9bc4e6d338367e1c6fe67bb5ca338dc0c9bb408fc1", |
| 52 | 52 | "fd1b67b66fb8ff34326ca5cb86ab04678619dfea420f21d8f85b2d05c999907f", |
| 53 | 53 | "f836a1da11c1f51a255301c4ee62c441612baada0345c1310f4149e5d5ccf5b9", |
| 54 | "72f67a8e8f06f9b9fcac58ff22eb3f4222c77a0968da5981d4e7dce8d4b8ce7d" | |
| 54 | "72f67a8e8f06f9b9fcac58ff22eb3f4222c77a0968da5981d4e7dce8d4b8ce7d", | |
| 55 | "166c5e5ec18272d556b87786396c5c3a17da8b56185643e8efeeb83742cc2b5b" | |
| 55 | 56 | ] |
src/pages/clock.ts +2 −1
| @@ -188,7 +188,8 @@ function render(input: { | ||
| 188 | 188 | const overdue = open.filter((d) => urgency(d.due, on, false) === "overdue").length; |
| 189 | 189 | const soon = open.filter((d) => urgency(d.due, on, false) === "soon").length; |
| 190 | 190 | const { start, days } = span(deals, on); |
| 191 | const today = deals.map((deal) => reminderRows(deal, on, agent)); | |
| 191 | // A closed deal is not on the clock, but its check-in is a reminder for today. | |
| 192 | const today = [...deals, ...closed].map((deal) => reminderRows(deal, on, agent)); | |
| 192 | 193 | const todayCount = today.reduce((n, t) => n + t.count, 0); |
| 193 | 194 | const none = (q !== "" || side !== "") && found.length === 0; |
| 194 | 195 | const toSend = today.reduce((n, t) => n + t.toSend, 0); |
src/pages/deal.ts +14 −1
| @@ -12,7 +12,7 @@ import { DEFAULT_LENGTHS, PARTY_LABEL, PARTY_ROLES, SUGGESTED_DATES } from "../d | ||
| 12 | 12 | import { escape } from "../http.ts"; |
| 13 | 13 | import { closingLine } from "../closing.ts"; |
| 14 | 14 | import { commission, dollars, percent } from "../money.ts"; |
| 15 | import { drafts, sentLabel, statusDrafts, type Agent } from "../reminders.ts"; | |
| 15 | import { checkinDrafts, drafts, sentLabel, statusDrafts, type Agent } from "../reminders.ts"; | |
| 16 | 16 | import type { Who } from "../who.ts"; |
| 17 | 17 | import { amendForm, type AmendState } from "./amend.ts"; |
| 18 | 18 | import { partyContact } from "./contact.ts"; |
| @@ -96,6 +96,18 @@ function statusCard(deal: DealView, agent: Agent, on: string, may: boolean, to: | ||
| 96 | 96 | </section>`; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | /** A closed deal's check-in: the message to each past client a month after the closing, waiting for the agent's word. */ | |
| 100 | function checkinCard(deal: DealView, agent: Agent, on: string, may: boolean, to: string): string { | |
| 101 | // Offered on its day, or once it has a record (sent, declined, held); never before. | |
| 102 | const these = checkinDrafts(deal, agent).filter((d) => d.on <= on || d.sent_at !== null || d.declined !== null || d.held !== null); | |
| 103 | if (these.length === 0) return ""; | |
| 104 | return `<section class="card" id="checkin"> | |
| 105 | <h2>Check-in</h2> | |
| 106 | <p class="muted small">A month after closing: how the move went, and a gentle ask for a referral. Nothing goes out until you send it.</p> | |
| 107 | <ul class="drafts">${these.map((d) => draftItem(d, on, may, to)).join("")}</ul> | |
| 108 | </section>`; | |
| 109 | } | |
| 110 | ||
| 99 | 111 | /** The record of what went out: each sent reminder with the words approved, newest first. */ |
| 100 | 112 | function messages(deal: DealView, may: boolean, agent: Agent, to: string): string { |
| 101 | 113 | const holding = drafts(deal, agent).flatMap((d) => (d.held === null ? [] : [{ d, held: d.held }])); |
| @@ -347,6 +359,7 @@ export function dealPage(input: { | ||
| 347 | 359 | ${parties} |
| 348 | 360 | </section> |
| 349 | 361 | ${statusCard(deal, agent ?? defaults, on, may, path)} |
| 362 | ${checkinCard(deal, agent ?? defaults, on, may, path)} | |
| 350 | 363 | <section class="card" id="messages"> |
| 351 | 364 | <h2>Messages</h2> |
| 352 | 365 | ${messages(deal, may, agent ?? defaults, path)} |
src/pages/sheet.ts +3 −1
| @@ -182,7 +182,9 @@ export function draftItem(draft: Draft, on: string, may: boolean, to: string): s | ||
| 182 | 182 | * for, where the draft is edited and sent. The clock carries no forms. |
| 183 | 183 | */ |
| 184 | 184 | export const draftLink = (draft: Draft, on: string): string => |
| 185 | `<li class="draft"><a class="draft-open" href="/deals/${draft.deal_id}#sheet-${draft.deadline_id}" data-sheet="sheet-${draft.deadline_id}" data-sheets="/deals/${draft.deal_id}/sheets">${draftLine(draft, on, true)}</a></li>`; | |
| 185 | draft.moment === "checkin" | |
| 186 | ? `<li class="draft"><a class="draft-open" href="/deals/${draft.deal_id}#checkin">${draftLine(draft, on, true)}</a></li>` | |
| 187 | : `<li class="draft"><a class="draft-open" href="/deals/${draft.deal_id}#sheet-${draft.deadline_id}" data-sheet="sheet-${draft.deadline_id}" data-sheets="/deals/${draft.deal_id}/sheets">${draftLine(draft, on, true)}</a></li>`; | |
| 186 | 188 | |
| 187 | 189 | export function sheet(deal: DealView, d: DeadlineView, who: Who, on: string, to: string, agent: Agent = defaults, typed?: { id: number; note: string }): string { |
| 188 | 190 | const id = sheetId(d); |
src/reminders.ts +58 −3
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | |
| 11 | 11 | import { addDays, relative, short, spoken, today, weekday } from "./dates.ts"; |
| 12 | 12 | import { closingAfterDate } from "./closing.ts"; |
| 13 | import { checkinOn, checkinRoles, checkinWords } from "./checkin.ts"; | |
| 13 | 14 | import { dollars } from "./money.ts"; |
| 14 | 15 | import { memoizer, print } from "./memo.ts"; |
| 15 | 16 | import { DEFAULT_LEAD, isOpen, KIND, PARTY_LABEL, type PartyRole } from "./deadlines.ts"; |
| @@ -59,6 +60,7 @@ export interface Draft { | ||
| 59 | 60 | |
| 60 | 61 | export const MOMENTS: readonly Moment[] = ["before", "day_of", "late", "moved"]; |
| 61 | 62 | const MOMENT_LABEL: Readonly<Record<Exclude<Moment, "before">, string>> = { |
| 63 | checkin: "Check-in", | |
| 62 | 64 | status: "Status update", |
| 63 | 65 | day_of: "Morning of", |
| 64 | 66 | late: "Overdue follow-up", |
| @@ -186,8 +188,12 @@ function words( | ||
| 186 | 188 | }; |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | /** Every reminder an open date of this deal has, sent or not; a closed deal reminds no one. */ | |
| 191 | /** | |
| 192 | * Every reminder an open date of this deal has, sent or not; a closed deal | |
| 193 | * reminds no one of a date, but has its check-ins a month after the closing. | |
| 194 | */ | |
| 190 | 195 | export function drafts(deal: DealView, agent: Agent): readonly Draft[] { |
| 196 | if (deal.closed && !deal.fell_through) return checkinDrafts(deal, agent); | |
| 191 | 197 | if (deal.closed || deal.fell_through) return []; |
| 192 | 198 | return remembered(`${JSON.stringify(agent)}|${print(deal)}`, () => |
| 193 | 199 | deal.deadlines |
| @@ -243,6 +249,54 @@ export function draftsFor(deal: DealView, deadline: DeadlineView, agent: Agent): | ||
| 243 | 249 | ); |
| 244 | 250 | } |
| 245 | 251 | |
| 252 | // ---- the check-in: a month after the closing, to the clients ---- | |
| 253 | ||
| 254 | /** | |
| 255 | * The check-in each client with a contact is owed once the closing has been | |
| 256 | * marked done: the buyers, the sellers or both, by the deal's side, the | |
| 257 | * morning 30 days after that day. Keyed by the closing and the day it was | |
| 258 | * marked done, so a deal reopened and closed again is a new check-in; a | |
| 259 | * reopened deal, or one that fell through, has none. | |
| 260 | */ | |
| 261 | export function checkinDrafts(deal: DealView, agent: Agent): Draft[] { | |
| 262 | const closing = deal.deadlines.find((d) => d.kind === "closing"); | |
| 263 | if (!deal.closed || deal.fell_through || closing === undefined || closing.done_on === null) return []; | |
| 264 | const doneOn = closing.done_on; | |
| 265 | const roles = checkinRoles(deal.side); | |
| 266 | return deal.parties | |
| 267 | .filter((p) => roles.includes(p.role) && p.contact !== "") | |
| 268 | .map((party) => { | |
| 269 | const mine = (s: { deadline_id: number; party_id: number; moment: Moment; due: string; move_id: number }): boolean => | |
| 270 | s.deadline_id === closing.id && s.party_id === party.id && s.moment === "checkin" && s.due === doneOn && s.move_id === 0; | |
| 271 | const sent = deal.sent.find(mine); | |
| 272 | const declined = deal.declined.find(mine); | |
| 273 | const held = sent === undefined && declined === undefined ? deal.held.find(mine) : undefined; | |
| 274 | const drafted = checkinWords(deal.address, first(party.name), signOff(agent)); | |
| 275 | return { | |
| 276 | deal_id: deal.id, | |
| 277 | address: deal.address, | |
| 278 | deadline_id: closing.id, | |
| 279 | label: closing.label, | |
| 280 | due: doneOn, | |
| 281 | party_id: party.id, | |
| 282 | party_name: party.name, | |
| 283 | party_role: party.role, | |
| 284 | contact: party.contact, | |
| 285 | email: party.email, | |
| 286 | phone: party.phone, | |
| 287 | moment: "checkin" as const, | |
| 288 | lead_days: closing.lead_days, | |
| 289 | move_id: 0, | |
| 290 | on: checkinOn(doneOn), | |
| 291 | subject: sent !== undefined && sent.subject !== "" ? sent.subject : held !== undefined && held.subject !== "" ? held.subject : drafted.subject, | |
| 292 | body: sent !== undefined && sent.subject !== "" ? sent.body : held !== undefined && held.body !== "" ? held.body : drafted.body, | |
| 293 | sent_at: sent?.sent_at ?? null, | |
| 294 | declined: declined === undefined ? null : { reason: declined.reason, by_name: declined.by_name }, | |
| 295 | held: held === undefined ? null : { until: held.until, from: held.held_on, by_name: held.by_name }, | |
| 296 | }; | |
| 297 | }); | |
| 298 | } | |
| 299 | ||
| 246 | 300 | // ---- the status update: one message about the deal as a whole ---- |
| 247 | 301 | |
| 248 | 302 | /** At most this many open dates are named as what comes next. */ |
| @@ -331,6 +385,7 @@ export function statusDrafts(deal: DealView, agent: Agent): Draft[] { | ||
| 331 | 385 | |
| 332 | 386 | /** The draft of `moment` that `party` has on `deadline`, if any: a reminder, or the deal's status update on its closing date. */ |
| 333 | 387 | export function draftOfMoment(deal: DealView, deadline: DeadlineView, agent: Agent, party: Party, moment: Moment): Draft | undefined { |
| 388 | if (moment === "checkin") return deadline.kind === "closing" ? checkinDrafts(deal, agent).find((r) => r.party_id === party.id) : undefined; | |
| 334 | 389 | if (moment !== "status" && !isOpen(deadline)) return undefined; |
| 335 | 390 | const these = moment === "status" ? (deadline.kind === "closing" ? statusDrafts(deal, agent) : []) : draftsFor(deal, deadline, agent); |
| 336 | 391 | return these.find((r) => r.party_id === party.id && r.moment === moment); |
| @@ -350,8 +405,8 @@ export const dueOn = (deals: readonly DealView[], day: string, agent: Agent): Dr | ||
| 350 | 405 | */ |
| 351 | 406 | export const pending = (d: Draft, day: string): boolean => |
| 352 | 407 | d.held !== null |
| 353 | ? d.held.until <= day && (d.on === day || d.due >= day || d.moment === "late") | |
| 354 | : d.on === day || (d.on < day && unsent(d) && (d.due >= day || d.moment === "late")); | |
| 408 | ? d.held.until <= day && (d.on === day || d.due >= day || d.moment === "late" || d.moment === "checkin") | |
| 409 | : d.on === day || (d.on < day && unsent(d) && (d.due >= day || d.moment === "late" || d.moment === "checkin")); | |
| 355 | 410 | |
| 356 | 411 | /** |
| 357 | 412 | * The drafts waiting on `day` across these deals, in the order the clock lists |
src/routes.ts +12 −8
| @@ -320,7 +320,7 @@ export const DEAL: Schema = { | ||
| 320 | 320 | id: { type: "integer" }, |
| 321 | 321 | deadline_id: { type: "integer" }, |
| 322 | 322 | party_id: { type: "integer" }, |
| 323 | moment: { enum: ["before", "day_of", "late", "moved", "status"] }, | |
| 323 | moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] }, | |
| 324 | 324 | due: DATE, |
| 325 | 325 | reason: { type: "string", description: "Why the agent chose not to send it." }, |
| 326 | 326 | by_name: { type: "string" }, |
| @@ -341,7 +341,7 @@ export const DEAL: Schema = { | ||
| 341 | 341 | label: { type: "string", description: "The date it was about, as named when sent." }, |
| 342 | 342 | party_name: { type: "string" }, |
| 343 | 343 | party_role: { type: "string", description: "The party's role when sent; empty on a reminder sent before roles were kept." }, |
| 344 | moment: { enum: ["before", "day_of", "late", "moved", "status"] }, | |
| 344 | moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] }, | |
| 345 | 345 | due: DATE, |
| 346 | 346 | by_name: { type: "string" }, |
| 347 | 347 | sent_at: { type: "string" }, |
| @@ -404,7 +404,11 @@ export const DRAFT: Schema = { | ||
| 404 | 404 | email: { type: "string" }, |
| 405 | 405 | phone: { type: "string" }, |
| 406 | 406 | contact: CONTACT, |
| 407 | moment: { enum: ["before", "day_of", "late", "moved", "status"] }, | |
| 407 | moment: { | |
| 408 | enum: ["before", "day_of", "late", "moved", "status", "checkin"], | |
| 409 | description: | |
| 410 | "Why it goes out. checkin is the \"How is the new home?\" message to a past client 30 days after the deal's closing was marked done (buyers on a buyer-side deal, sellers on a listing, both on a both-sides deal); it hangs on the closing's deadline_id, its due is the day the closing was marked done, and a reopened or fell-through deal has none.", | |
| 411 | }, | |
| 408 | 412 | on: DATE, |
| 409 | 413 | subject: { type: "string" }, |
| 410 | 414 | body: { type: "string" }, |
| @@ -1345,7 +1349,7 @@ export const routes: readonly Route[] = [ | ||
| 1345 | 1349 | }, |
| 1346 | 1350 | api: { |
| 1347 | 1351 | summary: |
| 1348 | "The reminders that go out today and have not been sent: call it each morning. It sends nothing and changes nothing.", | |
| 1352 | "The reminders that go out today and have not been sent, including the check-in (moment checkin) owed to past clients 30 days after a closing was marked done: call it each morning. It sends nothing and changes nothing.", | |
| 1349 | 1353 | answer: { |
| 1350 | 1354 | type: "object", |
| 1351 | 1355 | properties: { on: { type: "string", format: "date" }, reminders: list(DRAFT) }, |
| @@ -1539,7 +1543,7 @@ export const routes: readonly Route[] = [ | ||
| 1539 | 1543 | "Choose not to send a reminder, with a reason (1 to 200 characters). It is kept as a record, no longer counts as to send, and leaves /tick.", |
| 1540 | 1544 | body: { |
| 1541 | 1545 | type: "object", |
| 1542 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status"] }, reason: { type: "string", minLength: 1, maxLength: 200 } }, | |
| 1546 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] }, reason: { type: "string", minLength: 1, maxLength: 200 } }, | |
| 1543 | 1547 | required: ["deadline_id", "party_id", "moment", "reason"], |
| 1544 | 1548 | }, |
| 1545 | 1549 | answer: { type: "object", properties: { id: { type: "integer" }, reason: { type: "string" }, by_name: { type: "string" } }, required: ["id", "reason"] }, |
| @@ -1560,7 +1564,7 @@ export const routes: readonly Route[] = [ | ||
| 1560 | 1564 | "Hold a reminder until tomorrow: it leaves today's list and /tick, and comes back the next morning with its words. Give subject (up to 150 characters) and body (up to 2000) to hold the agent's edited words; leave them out to keep any words already held. Held again, it waits one more day. A status update is not held.", |
| 1561 | 1565 | body: { |
| 1562 | 1566 | type: "object", |
| 1563 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved"] }, subject: { type: "string", minLength: 1, maxLength: 150 }, body: { type: "string", minLength: 1, maxLength: 2000 } }, | |
| 1567 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "checkin"] }, subject: { type: "string", minLength: 1, maxLength: 150 }, body: { type: "string", minLength: 1, maxLength: 2000 } }, | |
| 1564 | 1568 | required: ["deadline_id", "party_id", "moment"], |
| 1565 | 1569 | }, |
| 1566 | 1570 | answer: { type: "object", properties: { id: { type: "integer" }, until: { type: "string" }, by_name: { type: "string" } }, required: ["id", "until"] }, |
| @@ -1580,7 +1584,7 @@ export const routes: readonly Route[] = [ | ||
| 1580 | 1584 | summary: "Bring a held reminder back to today: the hold is deleted and the reminder returns to today's list and /tick. Refused as a conflict when it is not held, or was already sent or declined.", |
| 1581 | 1585 | body: { |
| 1582 | 1586 | type: "object", |
| 1583 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved"] } }, | |
| 1587 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "checkin"] } }, | |
| 1584 | 1588 | required: ["deadline_id", "party_id", "moment"], |
| 1585 | 1589 | }, |
| 1586 | 1590 | answer: { type: "object", properties: { id: { type: "integer" } }, required: ["id"] }, |
| @@ -1601,7 +1605,7 @@ export const routes: readonly Route[] = [ | ||
| 1601 | 1605 | summary: "Take back a decline: the reminder is a draft again.", |
| 1602 | 1606 | body: { |
| 1603 | 1607 | type: "object", |
| 1604 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status"] } }, | |
| 1608 | properties: { deadline_id: { type: "integer" }, party_id: { type: "integer" }, moment: { enum: ["before", "day_of", "late", "moved", "status", "checkin"] } }, | |
| 1605 | 1609 | required: ["deadline_id", "party_id", "moment"], |
| 1606 | 1610 | }, |
| 1607 | 1611 | answer: { type: "object", properties: { id: { type: "integer" } }, required: ["id"] }, |
new above
offline
Filter to drafts that are due (
d.on <= on) or already sent, declined or held; as written the card and its Send form appear the day the closing is marked done, 30 days early. Add a before/after-day-30 test on dealPage.