Public: anyone can read this; the crew can change it.

A listing deal carries the date the listing agreement expires, and the clock and the deal page flag a closing that would fall after it #188

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/deal-clock:mason/174-a-listing-deal-carries-the-date-the-list → main 4 commits fork 3 threads · 3 unresolved

  • Merged. mason/174-a-listing-deal-carries-the-date-the-list was merged into main as 06ec35c.

Review

Sign in to review this change.
18 files changed +253 −57
README.md +6 −1
@@ -81,7 +81,12 @@ phone or email, into **Find a deal** above the clock and press Find (try
8181 `harbor`). The clock, This week and today's reminders narrow to the matches;
8282 **Clear** brings them back. The **Side** choice beside it narrows to deals
8383 where you are the buyer's agent or the listing agent. 9 Orchard Row is a
84 listing in the samples.
84 listing in the samples; on a listing, add "Listing agreement expires" as a
85 date and the clock and the deal page flag a closing that falls after it (9
86 Orchard Row shows the flag). It is yours alone: it is never on the client
87 timeline and no party is drafted anything about it. You see it on the clock, in
88 This week and on the deal's page, and the calendar file gives it an alarm 30
89 days ahead.
8590
8691 ## Opening and shaping a deal
8792
contract/openapi.json +15 −9
@@ -1113,7 +1113,8 @@
11131113 "seller",
11141114 "lender",
11151115 "title",
1116 "other_agent"
1116 "other_agent",
1117 "agent"
11171118 ]
11181119 },
11191120 "what": {
@@ -1164,7 +1165,8 @@
11641165 "seller",
11651166 "lender",
11661167 "title",
1167 "other_agent"
1168 "other_agent",
1169 "agent"
11681170 ]
11691171 },
11701172 "by": {
@@ -1200,7 +1202,7 @@
12001202 },
12011203 "conflicts": {
12021204 "type": "array",
1203 "description": "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Empty when the deal is in order or closed.",
1205 "description": "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Also the listing agreement's end (a custom date of that label) when the open Closing falls on or after it. Empty when the deal is in order or closed.",
12041206 "items": {
12051207 "type": "object",
12061208 "properties": {
@@ -2335,7 +2337,7 @@
23352337 "type": "string",
23362338 "minLength": 1,
23372339 "maxLength": 100,
2338 "description": "What the date is. Common labels: Seller disclosures due; HOA documents review ends; Survey due; Repair request deadline; Home warranty ordered; Lead paint inspection ends."
2340 "description": "What the date is. Common labels: Seller disclosures due; HOA documents review ends; Survey due; Repair request deadline; Home warranty ordered; Lead paint inspection ends; Listing agreement expires."
23392341 },
23402342 "due": {
23412343 "type": "string",
@@ -2400,7 +2402,8 @@
24002402 "seller",
24012403 "lender",
24022404 "title",
2403 "other_agent"
2405 "other_agent",
2406 "agent"
24042407 ]
24052408 },
24062409 "what": {
@@ -2527,7 +2530,8 @@
25272530 "seller",
25282531 "lender",
25292532 "title",
2530 "other_agent"
2533 "other_agent",
2534 "agent"
25312535 ]
25322536 },
25332537 "note": {
@@ -3277,7 +3281,8 @@
32773281 "seller",
32783282 "lender",
32793283 "title",
3280 "other_agent"
3284 "other_agent",
3285 "agent"
32813286 ]
32823287 },
32833288 "what": {
@@ -3328,7 +3333,8 @@
33283333 "seller",
33293334 "lender",
33303335 "title",
3331 "other_agent"
3336 "other_agent",
3337 "agent"
33323338 ]
33333339 },
33343340 "by": {
@@ -3364,7 +3370,7 @@
33643370 },
33653371 "conflicts": {
33663372 "type": "array",
3367 "description": "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Empty when the deal is in order or closed.",
3373 "description": "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Also the listing agreement's end (a custom date of that label) when the open Closing falls on or after it. Empty when the deal is in order or closed.",
33683374 "items": {
33693375 "type": "object",
33703376 "properties": {
src/deadlines.ts +21
@@ -7,6 +7,7 @@
77
88 import { addBusinessDays, addDays, daysBetween } from "./dates.ts";
99 import { standard } from "./env.ts";
10 import type { Side } from "./side.ts";
1011
1112 export const PARTY_ROLES = [
1213 "buyer",
@@ -14,14 +15,18 @@ export const PARTY_ROLES = [
1415 "lender",
1516 "title",
1617 "other_agent",
18 "agent",
1719 ] as const;
1820 export type PartyRole = (typeof PARTY_ROLES)[number];
21 /** The roles a person on a deal can hold: every role but the agent, who is the one using the app and is never added as a party. */
22 export const CONTACT_ROLES: readonly PartyRole[] = PARTY_ROLES.filter((r) => r !== "agent");
1923 export const PARTY_LABEL: Readonly<Record<PartyRole, string>> = {
2024 buyer: "Buyer",
2125 seller: "Seller",
2226 lender: "Lender",
2327 title: "Title company",
2428 other_agent: "Other agent",
29 agent: "Agent",
2530 };
2631 /** A date is open until it is done or waived; only an open date drafts reminders, flags or conflicts. */
2732 export const isOpen = (d: { done_at: string | null; waived_at: string | null }): boolean => d.done_at === null && d.waived_at === null;
@@ -32,6 +37,9 @@ export const isWaivable = (kind: string): boolean => kind !== "closing";
3237
3338 export const isPartyRole = (v: unknown): v is PartyRole =>
3439 PARTY_ROLES.includes(v as PartyRole);
40 /** A role a party can be added in: not the agent. */
41 export const isContactRole = (v: unknown): v is PartyRole =>
42 CONTACT_ROLES.includes(v as PartyRole);
3543
3644 export const KINDS = [
3745 "earnest",
@@ -62,7 +70,13 @@ export interface Suggestion {
6270 readonly label: string;
6371 /** Days before it is due that its first reminder goes out. */
6472 readonly lead: number;
73 /** The sides of a deal that offer it; every side when absent. */
74 readonly sides?: readonly Side[];
75 /** Who owes it when typed from the suggestion; the form's default when absent. */
76 readonly owes?: PartyRole;
6577 }
78 /** The listing agreement's end: the agent's own paperwork, so only the agent owes it and no client is told of it. */
79 export const LISTING_EXPIRES = "Listing agreement expires";
6680 export const SUGGESTED_DATES: readonly Suggestion[] = [
6781 { label: "Seller disclosures due", lead: 3 },
6882 { label: "HOA documents review ends", lead: 5 },
@@ -70,7 +84,14 @@ export const SUGGESTED_DATES: readonly Suggestion[] = [
7084 { label: "Repair request deadline", lead: 2 },
7185 { label: "Home warranty ordered", lead: 3 },
7286 { label: "Lead paint inspection ends", lead: 3 },
87 { label: LISTING_EXPIRES, lead: 30, sides: ["listing", "both"], owes: "agent" },
7388 ];
89 /** The suggestions a deal on `side` offers. */
90 export const suggestedFor = (side: Side): readonly Suggestion[] => SUGGESTED_DATES.filter((s) => s.sides === undefined || s.sides.includes(side));
91 /** The agent's own date, matched by its exact label like `leadOfLabel`: no client sees it or is reminded of it. */
92 export const isInternal = (d: { readonly kind: string; readonly label: string }): boolean => d.kind === "custom" && d.label === LISTING_EXPIRES;
93 /** Who a date's reminders go to besides whoever owes it: nobody for the agent's own date. */

Exact-label matching with no side check: a buyer-side deal can still carry this date. Gate on side.

94 export const notifiedOf = (d: { readonly kind: Kind; readonly label: string }): readonly PartyRole[] => (isInternal(d) ? [] : KIND[d.kind].notify);
7495 /** The lead a typed label starts from: its suggestion's when it matches exactly, else the default. */
7596 export const leadOfLabel = (label: string): number =>
7697 SUGGESTED_DATES.find((s) => s.label === label)?.lead ?? DEFAULT_LEAD;
src/deals.ts +14 −6
@@ -13,13 +13,16 @@ import {
1313 DEFAULT_LENGTHS,
1414 isClosed,
1515 isOpen,
16 isPartyRole,
16 isContactRole,
17 isInternal,
1718 isWaivable,
1819 KIND,
1920 LEAD_MAX,
2021 LEAD_MIN,
2122 leadOf,
2223 leadOfLabel,
24 LISTING_EXPIRES,
25 notifiedOf,
2326 PARTY_LABEL,
2427 schedule,
2528 type Kind,
@@ -892,13 +895,15 @@ export function setOwes(
892895 const { dealId, found } = deadlineFor(db, who, input.id, input.dealId);
893896 if (!found.ok) return within(db, who, OWES_WHAT, dealId, found);
894897 const { deadline } = found.value;
895 if (!isPartyRole(input.owes))
898 if (isInternal(found.value.deadline))
899 return within(db, who, OWES_WHAT, dealId, fail("conflict", "The listing agreement is the agent's own date; no one else can owe it.", "owes"));
900 if (!isContactRole(input.owes))
896901 return within(db, who, OWES_WHAT, dealId, fail("invalid", "Say which party owes it.", "owes"));
897902 if (!isOpen(deadline))
898903 return within(db, who, OWES_WHAT, dealId, fail("conflict", `This date is ${deadline.waived_at !== null ? "waived" : "done"}; reopen it before changing who owes it.`));
899904 if (input.owes === deadline.owes)
900905 return within(db, who, OWES_WHAT, dealId, fail("invalid", `${PARTY_LABEL[input.owes]} already owes it.`, "owes"));
901 const told = [input.owes, ...KIND[deadline.kind].notify];
906 const told = [input.owes, ...notifiedOf(deadline)];
902907 db.transaction(() => {
903908 db.query("UPDATE deadline SET owes = ?1, owes_from = ?2, owes_by = ?3, owes_on = ?4 WHERE id = ?5").run(input.owes as string, deadline.owes, authorOf(who).name, today(zoneOf(db)), deadline.id);
904909 for (const h of db.query<{ id: number; moment: string; role: string }, [number]>(
@@ -1071,7 +1076,10 @@ export function addDeadline(
10711076 return within(db, who, "date.add", dealId, fail("invalid", "Name the date (up to 100 characters).", "label"));
10721077 if (!isDate(input.due))
10731078 return within(db, who, "date.add", dealId, fail("invalid", "The date is a date (YYYY-MM-DD).", "due"));
1074 if (!isPartyRole(input.owes))
1079 const own = label === LISTING_EXPIRES;
1080 if (own && deal.value.side === "buyer")
1081 return within(db, who, "date.add", dealId, fail("invalid", "A buyer-side deal has no listing agreement; make it a listing or both-sides deal first.", "label"));
1082 if (!own && !isContactRole(input.owes))
10751083 return within(db, who, "date.add", dealId, fail("invalid", "Say which party owes it.", "owes"));
10761084 const what = input.what === undefined || input.what === "" ? "" : line(input.what, 1, 200);
10771085 if (what === undefined)
@@ -1083,7 +1091,7 @@ export function addDeadline(
10831091 .query<Deadline, [number, string, string, string, string, number]>(
10841092 "INSERT INTO deadline (deal_id, kind, label, due, owes, what, lead_days) VALUES (?1, 'custom', ?2, ?3, ?4, ?5, ?6) RETURNING *",
10851093 )
1086 .get(deal.value.id, label, input.due, input.owes, what, given ? (input.leadDays as number) : leadOfLabel(label))!;
1094 .get(deal.value.id, label, input.due, own ? "agent" : (input.owes as string), what, given ? (input.leadDays as number) : leadOfLabel(label))!;
10871095 return within(db, who, "date.add", dealId, ok(made));
10881096 }
10891097
@@ -1129,7 +1137,7 @@ export function addParty(
11291137 const deal = dealFor(db, who, "update", input.dealId);
11301138 const dealId = deal.ok ? deal.value.id : undefined;
11311139 if (!deal.ok) return within(db, who, "party.add", Number.isInteger(input.dealId) ? input.dealId : undefined, deal);
1132 if (!isPartyRole(input.role))
1140 if (!isContactRole(input.role))
11331141 return within(db, who, "party.add", dealId, fail("invalid", "A party is a buyer, seller, lender, title company or the other agent."));
11341142 const text = partyText(input);
11351143 if (!text.ok) return within(db, who, "party.add", dealId, text);
src/import.ts +8 −4
@@ -10,7 +10,8 @@
1010 import type { Database } from "bun:sqlite";
1111 import { permit } from "./contract.ts";
1212 import { isDate } from "./dates.ts";
13 import { KIND, KINDS, isPartyRole, leadOf, leadOfLabel, type Kind, type PartyRole } from "./deadlines.ts";
13 import { sideOf } from "./side.ts";
14 import { KIND, KINDS, isContactRole, isInternal, leadOf, leadOfLabel, type Kind, type PartyRole } from "./deadlines.ts";
1415 import { appointmentPlace, appointmentTime, isAppointment } from "./appointment.ts";
1516 import { closingPlace, closingTime } from "./closing.ts";
1617 import { NOTE_MAX, REASON_MAX, insertDeal, line, partyText, plan, sameAddress, type NewDeal, type Plan } from "./deals.ts";
@@ -88,7 +89,7 @@ function readDeal(raw: unknown, n: number): Result<DealIn> {
8889 const parties: PartyIn[] = [];
8990 for (const [i, p] of partiesRaw.entries()) {
9091 const o = obj(p);
91 if (!isPartyRole(o.role)) return refuse(n, `party ${i + 1} has no valid role.`, `parties[${i}].role`);
92 if (!isContactRole(o.role)) return refuse(n, `party ${i + 1} has no valid role.`, `parties[${i}].role`);
9293 const text = partyText(o);
9394 if (!text.ok) return refuse(n, `party ${i + 1}: ${text.message}`, `parties[${i}]`);
9495 parties.push({ role: o.role, ...text.value });
@@ -103,7 +104,10 @@ function readDeal(raw: unknown, n: number): Result<DealIn> {
103104 if (!KINDS.includes(o.kind as Kind)) return refuse(n, `date ${i + 1} has an unknown kind.`, `${at}.kind`);
104105 if (!isDate(o.due)) return refuse(n, `date ${i + 1} (${label}) is not a date (YYYY-MM-DD).`, `${at}.due`);
105106 const owes = o.owed_by;
106 if (!isPartyRole(owes)) return refuse(n, `date ${i + 1} (${label}) says no valid party owes it.`, `${at}.owed_by`);
107 // The agent's own date is always the agent's, and only a listing has one.
108 const own = isInternal({ kind: o.kind as string, label });
109 if (own && sideOf(d.side) === "buyer") return refuse(n, `date ${i + 1} (${label}) is a listing agreement, which a buyer-side deal does not have.`, `${at}.label`);
110 if (!own && !isContactRole(owes)) return refuse(n, `date ${i + 1} (${label}) says no valid party owes it.`, `${at}.owed_by`);
107111 const note = o.note === undefined || o.note === null || o.note === "" ? "" : line(o.note, 1, NOTE_MAX);
108112 if (note === undefined) return refuse(n, `the note on date ${i + 1} is up to ${NOTE_MAX} characters.`, `${at}.note`);
109113 // An inspection's or walkthrough's time and place, as the export wrote them; any other kind carries none.
@@ -130,7 +134,7 @@ function readDeal(raw: unknown, n: number): Result<DealIn> {
130134 return refuse(n, `move ${j + 1} of date ${i + 1} (${label}) is not a from and to date, a reason and who moved it.`, `${at}.moves[${j}]`);
131135 moves.push({ from: m.from, to: m.to, reason, by, at: when });
132136 }
133 dates.push({ label, kind: o.kind as Kind, due: o.due, owes, note, time: time.value, place: place.value, done, waived, waivedBy, moves });
137 dates.push({ label, kind: o.kind as Kind, due: o.due, owes: own ? "agent" : (owes as PartyRole), note, time: time.value, place: place.value, done, waived, waivedBy, moves });
134138 }
135139
136140 const closing = dates.find((x) => x.kind === "closing");
src/listing.test.ts added +141
@@ -0,0 +1,141 @@
1 import { expect, test } from "bun:test";
2 import { mkdtempSync } from "node:fs";
3 import { tmpdir } from "node:os";
4 import { join } from "node:path";
5 import { openDb } from "./db.ts";
6 import { LISTING_EXPIRES, suggestedFor } from "./deadlines.ts";
7 import { addDeadline, addParty, createDeal, getDeal, listDeals, markDone, moveDeadline, setOwes } from "./deals.ts";
8 import { exportDeals } from "./export.ts";
9 import { importDeals } from "./import.ts";
10 import { calendar } from "./ics.ts";
11 import { thisWeek } from "./week.ts";
12 import openapi from "../contract/openapi.json";
13 import { conflictLine } from "./order.ts";
14 import { drafts, recipients } from "./reminders.ts";
15 import { agent } from "./env.ts";
16 import { timelineRows } from "./timeline.ts";
17 import { tools } from "./mcp.ts";
18 import type { Who } from "./who.ts";
19
20 const db = openDb(mkdtempSync(join(tmpdir(), "app-listing-")));
21 const alice: Who = { role: "user", id: "u1", name: "alice" };
22
23 let n = 0;
24 function listing(side: "buyer" | "listing" | "both", expires: string) {
25 const made = createDeal(db, alice, { address: `${++n} ${side} Way`, buyer: "Bea Buyer", seller: "Sol Seller", contractDate: "2026-10-01", closingDate: "2026-12-03", side });
26 if (!made.ok) throw new Error(made.message);
27 const id = made.value.id;
28 const added = addDeadline(db, alice, { dealId: id, label: LISTING_EXPIRES, due: expires, owes: "buyer" });
29 if (!added.ok) throw new Error(added.message);
30 const get = () => { const d = getDeal(db, alice, { id }); if (!d.ok) throw new Error(d.message); return d.value; };
31 return { id, expiry: added.value, get };
32 }
33
34 test("the suggestion is offered for listing and both, not buyer, with a 30 day lead", () => {
35 const labels = (s: "buyer" | "listing" | "both") => suggestedFor(s).map((x) => x.label);
36 expect(labels("listing")).toContain(LISTING_EXPIRES);
37 expect(labels("both")).toContain(LISTING_EXPIRES);
38 expect(labels("buyer")).not.toContain(LISTING_EXPIRES);
outdated

void id; is there only to hush an unused binding; remove the binding.

39 const { expiry } = listing("listing", "2026-11-30");
40 expect(expiry.lead_days).toBe(30);
41 expect(expiry.owes).toBe("agent");
42 expect(expiry.kind).toBe("custom");
43 });
44
45 test("closing after the expiry is flagged in words, and moving either date clears it", () => {
46 const { expiry, get } = listing("listing", "2026-11-30");
47 const closing = get().deadlines.find((d) => d.kind === "closing")!;
48 expect(get().conflicts.map(conflictLine)).toEqual(["Closing (Dec 3) falls after the listing agreement expires (Nov 30): extend the listing or move closing."]);
49 expect(moveDeadline(db, alice, { id: expiry.id, due: "2026-12-10", reason: "Listing extended" }).ok).toBe(true);
50 expect(get().conflicts).toEqual([]);
51 expect(moveDeadline(db, alice, { id: expiry.id, due: "2026-12-03", reason: "Back" }).ok).toBe(true);
52 expect(get().conflicts.map(conflictLine)[0]).toContain("falls on the day the listing agreement expires");
53 expect(moveDeadline(db, alice, { id: expiry.id, due: "2026-12-04", reason: "Longer" }).ok).toBe(true);
54 expect(get().conflicts).toEqual([]);
55 expect(moveDeadline(db, alice, { id: closing.id, due: "2026-12-05", reason: "Slipped" }).ok).toBe(true);
56 expect(get().conflicts).toHaveLength(1);
57 expect(moveDeadline(db, alice, { id: closing.id, due: "2026-12-03", reason: "Back on" }).ok).toBe(true);
58 expect(get().conflicts).toEqual([]);
59 });
60
61 test("marking the expiry done clears the flag, and an expiry after closing is no out-of-order date", () => {
62 const { expiry, get } = listing("both", "2026-11-30");
63 expect(get().conflicts).toHaveLength(1);
64 expect(markDone(db, alice, { id: expiry.id, done: true }).ok).toBe(true);
65 expect(get().conflicts).toEqual([]);
66 const later = listing("listing", "2026-12-20");
67 expect(later.get().conflicts).toEqual([]);
68 });
69
70 test("the agent's own date is off the client timeline and tells no party", () => {
71 const { id, get } = listing("listing", "2026-11-30");
72 addParty(db, alice, { dealId: id, role: "other_agent", name: "Olive Other", email: "[email protected]" });
73 expect(timelineRows(get(), "2026-11-09").map((r) => r.label)).not.toContain(LISTING_EXPIRES);
74 const d = get().deadlines.find((x) => x.label === LISTING_EXPIRES)!;
75 for (const m of ["before", "day_of", "late", "moved"] as const) expect(recipients(get(), d, m)).toEqual([]);
76 const text = drafts(get(), agent).map((x) => x.subject + x.body).join("\n");
77 expect(text).not.toContain("Listing agreement");
78 expect(addParty(db, alice, { dealId: id, role: "agent", name: "Me" })).toMatchObject({ ok: false });
79 });
80
81 test("the API's deal and MCP's get_deal and move answer carry the conflict", () => {
82 const { get } = listing("listing", "2026-11-30");
83 const dealId = get().id;
84 const got = tools.find((t) => t.name === "get_deal")!.run(db, alice, { id: dealId }) as { ok: boolean; value: { conflicts: { label: string }[] } };
85 expect(got.value.conflicts.map((c) => c.label)).toEqual([LISTING_EXPIRES]);
86 const move = tools.find((t) => t.name === "move_date")!;
87 const out = move.run(db, alice, { id: get().deadlines.find((d) => d.kind === "financing")!.id, due: "2026-11-20", reason: "x" }) as { ok: boolean; value: { conflicts: { label: string }[] } };
88 expect(out.value.conflicts.map((c) => c.label)).toContain(LISTING_EXPIRES);
89 });
90
91 test("the label is the agent's on every path: no one else can be handed it, and a buyer-side deal has none", () => {
92 const { id, expiry, get } = listing("listing", "2026-11-30");
93 expect(setOwes(db, alice, { id: expiry.id, owes: "buyer" })).toMatchObject({ ok: false, field: "owes" });
94 expect(get().deadlines.find((d) => d.id === expiry.id)!.owes).toBe("agent");
95 const survey = addDeadline(db, alice, { dealId: id, label: "Survey due", due: "2026-11-15", owes: "buyer" });
96 if (!survey.ok) throw new Error(survey.message);
97 expect(setOwes(db, alice, { id: survey.value.id, owes: "agent" })).toMatchObject({ ok: false, field: "owes" });
98 expect(addDeadline(db, alice, { dealId: id, label: "Other", due: "2026-11-15", owes: "agent" })).toMatchObject({ ok: false, field: "owes" });
99 const buyerSide = createDeal(db, alice, { address: "Buyer Only Way", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-12-03" });
100 if (!buyerSide.ok) throw new Error(buyerSide.message);
101 expect(addDeadline(db, alice, { dealId: buyerSide.value.id, label: LISTING_EXPIRES, due: "2026-11-30", owes: "buyer" })).toMatchObject({ ok: false, field: "label" });
102 expect(getDeal(db, alice, { id: buyerSide.value.id }).ok && getDeal(db, alice, { id: buyerSide.value.id })).toMatchObject({ value: { conflicts: [] } });
103 });
104
105 test("import makes the label the agent's, and refuses it on a buyer-side deal", () => {
106 const { get } = listing("listing", "2026-11-30");
107 const file = JSON.parse(JSON.stringify(exportDeals([get()], new Date("2026-11-09T00:00:00Z"))));
108 file.deals[0].address = "Imported Way";
109 file.deals[0].dates.find((x: { label: string }) => x.label === LISTING_EXPIRES).owed_by = "buyer";
110 const brought = importDeals(db, alice, file);
111 if (!brought.ok) throw new Error(brought.message);
112 const back = getDeal(db, alice, { id: brought.value.id });
113 if (!back.ok) throw new Error(back.message);
114 expect(back.value.deadlines.find((d) => d.label === LISTING_EXPIRES)!.owes).toBe("agent");
115 file.deals[0].address = "Buyer Imported Way";
116 file.deals[0].side = "buyer";
117 expect(importDeals(db, alice, file)).toMatchObject({ ok: false });
118 });
119
120 test("the agent sees it on This week and on the calendar with its own alarm; no one else is drafted anything", () => {
121 const { get } = listing("listing", "2026-11-12");
122 const week = thisWeek([get()], "2026-11-09").map((i) => i.deadline.label);
123 expect(week).toContain(LISTING_EXPIRES);
124 const ics = calendar(get(), "deal-clock.example", new Date("2026-11-09T00:00:00Z"));
125 expect(ics).toContain(`SUMMARY:${LISTING_EXPIRES} — `);
126 expect(ics).toContain("DESCRIPTION:Agent owes");
127 expect(ics).toContain("Listing agreement expires in 30 days");
128 expect(drafts(get(), agent).filter((x) => x.label === LISTING_EXPIRES)).toEqual([]);
129 });
130
131 test("the API schema allows what the sample deals say about who owes a date", () => {
132 const schemas = (openapi as unknown as { components: { schemas: Record<string, { properties: { deadlines: { items: { properties: { owes: { enum: string[] } } } } } }> } }).components.schemas;
133 const owes = schemas.Deal!.properties.deadlines.items.properties.owes.enum;
134 expect(owes).toContain("agent");
135 const fresh = openDb(mkdtempSync(join(tmpdir(), "app-listing-sample-")));
136 const all = listDeals(fresh, alice);
137 if (!all.ok) throw new Error(all.message);
138 const seen = new Set(all.value.flatMap((d) => d.deadlines.map((x) => x.owes)));
139 expect(seen.has("agent")).toBe(true);
140 for (const o of seen) expect(owes).toContain(o);
141 });
src/mcp.ts +5 −5
@@ -11,7 +11,7 @@ import { restoreSamples, type Result } from "./actions.ts";
1111 import { today } from "./dates.ts";
1212 import { exportDeals } from "./export.ts";
1313 import { fail, ok } from "./result.ts";
14 import { DEFAULT_LENGTHS, PARTY_ROLES, SUGGESTED_DATES } from "./deadlines.ts";
14 import { CONTACT_ROLES, DEFAULT_LENGTHS, SUGGESTED_DATES } from "./deadlines.ts";
1515 import {
1616 addDeadline,
1717 conflictsOf,
@@ -89,7 +89,7 @@ export const tools: readonly Tool[] = [
8989 },
9090 {
9191 name: "get_deal",
92 description: "One deal by id. conflicts lists the open dates due on or after closing (a slipped contingency); empty when in order.",
92 description: "One deal by id. conflicts lists the open dates due on or after closing (a slipped contingency) and a listing agreement that expires on or before closing; empty when in order.",
9393 inputSchema: { type: "object", properties: { id: { type: "integer" } }, required: ["id"] },
9494 run: (db, who, args) => getDeal(db, who, { id: Number(args.id) }),
9595 },
@@ -158,7 +158,7 @@ export const tools: readonly Tool[] = [
158158 "Change which party owes an open date (not one already done or waived). Today's and later reminders are drafted to the new party; ones already sent stay as they were.",
159159 inputSchema: {
160160 type: "object",
161 properties: { id: { type: "integer" }, owes: { enum: [...PARTY_ROLES] } },
161 properties: { id: { type: "integer" }, owes: { enum: [...CONTACT_ROLES] } },
162162 required: ["id", "owes"],
163163 },
164164 run: (db, who, args) => setOwes(db, who, { id: Number(args.id), owes: args.owes }),
@@ -410,7 +410,7 @@ export const tools: readonly Tool[] = [
410410 deal_id: { type: "integer" },
411411 label: { type: "string", maxLength: 100 },
412412 due: { type: "string", format: "date" },
413 owes: { enum: [...PARTY_ROLES] },
413 owes: { enum: [...CONTACT_ROLES] },
414414 details: { type: "string", maxLength: 200 },
415415 },
416416 required: ["deal_id", "label", "due", "owes"],
@@ -475,7 +475,7 @@ export const tools: readonly Tool[] = [
475475 type: "object",
476476 properties: {
477477 deal_id: { type: "integer" },
478 role: { enum: [...PARTY_ROLES] },
478 role: { enum: [...CONTACT_ROLES] },
479479 name: { type: "string", maxLength: 100 },
480480 email: { type: "string", maxLength: 200 },
481481 phone: { type: "string", maxLength: 30, description: "Digits, spaces and + - ( ) . only." },
src/order.page.test.ts +4 −4
@@ -22,13 +22,13 @@ type Deal = {
2222 };
2323 const deals = async (): Promise<Deal[]> => (await fetch(`${base}/api/deals`, { headers: alice })).json() as Promise<Deal[]>;
2424
25 test("no sample deal is flagged on a fresh boot", async () => {
25 test("on a fresh boot only 9 Orchard Row is flagged, for its listing expiring before closing", async () => {
2626 const all = await deals();
2727 expect(all.length).toBeGreaterThan(0);
28 for (const deal of all) expect(deal.conflicts).toEqual([]);
28 for (const deal of all)
29 expect(deal.conflicts.map((c) => c.label)).toEqual(deal.address === "9 Orchard Row" ? ["Listing agreement expires"] : []);
2930 const page = await (await fetch(`${base}/`, { headers: alice })).text();
30 expect(page).not.toContain("data-conflict");
31 expect(page).not.toContain("out of order");
31 expect(page).toContain("1 out of order");
3232 });
3333
3434 test("moving Alder Lane's financing past closing succeeds and shows the flag everywhere", async () => {
src/order.ts +10 −5
@@ -5,7 +5,7 @@
55 */
66
77 import { short } from "./dates.ts";
8 import { isOpen } from "./deadlines.ts";
8 import { isInternal, isOpen, LISTING_EXPIRES } from "./deadlines.ts";
99
1010 /** An open, non-closing date that falls on or after the closing date. */
1111 export interface Conflict {
@@ -28,11 +28,16 @@ interface Dated {
2828 export function conflicts(deadlines: readonly Dated[]): Conflict[] {
2929 const closing = deadlines.find((d) => d.kind === "closing");
3030 if (closing === undefined || closing.done_at !== null) return [];
31 return deadlines
32 .filter((d) => d.kind !== "closing" && isOpen(d) && d.due >= closing.due)
31 const listing = deadlines.find((d) => isInternal(d) && isOpen(d) && closing.due >= d.due);
32 const late = deadlines
33 .filter((d) => d.kind !== "closing" && !isInternal(d) && isOpen(d) && d.due >= closing.due)
3334 .map((d) => ({ deadline_id: d.id, label: d.label, due: d.due, closing: closing.due }));
35 // The listing's end is meant to come after closing, so it is never "after closing" itself; the other way round is the conflict.
36 return listing === undefined ? late : [...late, { deadline_id: listing.id, label: listing.label, due: listing.due, closing: closing.due }];
3437 }
3538
36 /** "Financing (Nov 24) now falls after closing (Nov 20): move one or the other." */
39 /** "Closing (Dec 3) falls after the listing agreement expires (Nov 30): extend the listing or move closing."; otherwise "Financing (Nov 24) now falls after closing (Nov 20): move one or the other." */
3740 export const conflictLine = (c: Conflict): string =>
38 `${c.label} (${short(c.due)}) now falls ${c.due === c.closing ? "on" : "after"} closing (${short(c.closing)}): move one or the other.`;
41 c.label === LISTING_EXPIRES
42 ? `Closing (${short(c.closing)}) falls ${c.due === c.closing ? "on the day" : "after"} the listing agreement expires (${short(c.due)}): extend the listing or move closing.`
43 : `${c.label} (${short(c.due)}) now falls ${c.due === c.closing ? "on" : "after"} closing (${short(c.closing)}): move one or the other.`;
src/pages/deal.ts +5 −5
@@ -8,7 +8,7 @@ import { addDays, relative, short, spoken } from "../dates.ts";
88 import { canChange, canRemove, closedOn, EMAIL_MAX, fellOn, PHONE_MAX, REASON_MAX, type DealView, type Party, type Plan, type PlannedDate, type Sent } from "../deals.ts";
99 import { matchKnown, type Known } from "../people.ts";
1010 import { agent as defaults, standard } from "../env.ts";
11 import { DEFAULT_LENGTHS, PARTY_LABEL, PARTY_ROLES, SUGGESTED_DATES } from "../deadlines.ts";
11 import { CONTACT_ROLES, DEFAULT_LENGTHS, PARTY_LABEL, PARTY_ROLES, suggestedFor } from "../deadlines.ts";
1212 import { escape } from "../http.ts";
1313 import { coming, comingLine, type Coming } from "../coming.ts";
1414 import { closingLine } from "../closing.ts";
@@ -25,8 +25,8 @@ import { progressLine } from "./progress.ts";
2525 import { appointmentForm, appointmentText, type AppointmentProblem } from "./appointment.ts";
2626 import { badge, conflictLines, nonBusinessLine, noteLine, owesChangedLine, rollForm, draftItem, dueLine, outboxLine, owedBy, releaseForm, sheet, sheetId } from "./sheet.ts";
2727
28 const roleOptions = (selected?: string): string =>
29 PARTY_ROLES.map(
28 const roleOptions = (selected?: string, roles: readonly (typeof PARTY_ROLES)[number][] = PARTY_ROLES): string =>
29 roles.map(
3030 (r) => `<option value="${r}"${r === selected ? " selected" : ""}>${escape(PARTY_LABEL[r])}</option>`,
3131 ).join("");
3232
@@ -341,7 +341,7 @@ export function dealPage(input: {
341341 <h2>Add a date</h2>
342342 <p class="muted small">A date the contract adds: an HOA review, a repair deadline, a rate lock.</p>
343343 <form class="stack" method="post" action="${path}/deadlines">
344 <label>What<input class="input" name="label" required maxlength="100" list="suggested-dates" autocomplete="off" placeholder="HOA documents review ends"><datalist id="suggested-dates">${SUGGESTED_DATES.map((s) => `<option value="${escape(s.label)}"></option>`).join("")}</datalist></label>
344 <label>What<input class="input" name="label" required maxlength="100" list="suggested-dates" autocomplete="off" placeholder="HOA documents review ends"><datalist id="suggested-dates">${suggestedFor(deal.side).map((s) => `<option value="${escape(s.label)}"></option>`).join("")}</datalist></label>
345345 <div class="pair">
346346 <label>Date<input class="input" type="date" name="due" required value="${escape(addDays(on, 7))}"></label>
347347 <label>Owed by<select class="input" name="owes">${roleOptions("buyer")}</select></label>
@@ -355,7 +355,7 @@ export function dealPage(input: {
355355 ${pick}
356356 <form class="stack" method="post" action="${path}/parties">
357357 <div class="pair">
358 <label>Role<select class="input" name="role">${roleOptions(add?.role ?? "lender")}</select></label>
358 <label>Role<select class="input" name="role">${roleOptions(add?.role ?? "lender", CONTACT_ROLES)}</select></label>
359359 <label>Name<input class="input" name="name" required maxlength="100" value="${escape(add?.name ?? "")}"></label>
360360 </div>
361361 ${contactFields(add?.email ?? "", add?.phone ?? "", add?.message)}
src/pages/sheet.ts +2 −2
@@ -7,7 +7,7 @@
77
88 import { BODY_MAX, canChange, NOTE_MAX, ROLL_REASON, REASON_MAX, SUBJECT_MAX, type DealView, type DeadlineView } from "../deals.ts";
99 import { doneLine, relative, short, spoken, urgencyOf, type Urgency } from "../dates.ts";
10 import { isOpen, isWaivable, LEAD_MAX, LEAD_MIN, PARTY_LABEL, PARTY_ROLES } from "../deadlines.ts";
10 import { CONTACT_ROLES, isInternal, isOpen, isWaivable, LEAD_MAX, LEAD_MIN, PARTY_LABEL } from "../deadlines.ts";
1111 import { escape } from "../http.ts";
1212 import { confirmRemove } from "./confirm.ts";
1313 import { memoizer, print } from "../memo.ts";
@@ -243,7 +243,7 @@ export function sheet(deal: DealView, d: DeadlineView, who: Who, on: string, to:
243243 ${
244244 isOpen(d)
245245 ? `<form class="move" method="post" action="/deadlines/${d.id}/owes">${hidden({ to })}
246 <label>Owed by<select class="input" name="owes">${PARTY_ROLES.map((r) => `<option value="${r}"${r === d.owes ? " selected" : ""}>${escape(PARTY_LABEL[r])}</option>`).join("")}</select></label>
246 <label>Owed by<select class="input" name="owes">${(isInternal(d) ? ["agent" as const] : CONTACT_ROLES).map((r) => `<option value="${r}"${r === d.owes ? " selected" : ""}>${escape(PARTY_LABEL[r])}</option>`).join("")}</select></label>
247247 <button class="button button-quiet">Change who owes it</button>
248248 </form>`
249249 : ""
src/reminders.ts +3 −3
@@ -14,7 +14,7 @@ import { closingAfterDate } from "./closing.ts";
1414 import { ANNIVERSARY_YEARS, anniversaryOn, anniversaryWords, checkinOn, checkinRoles, checkinWords } from "./checkin.ts";
1515 import { dollars } from "./money.ts";
1616 import { memoizer, print } from "./memo.ts";
17 import { DEFAULT_LEAD, isOpen, KIND, PARTY_LABEL, type PartyRole } from "./deadlines.ts";
17 import { DEFAULT_LEAD, isInternal, isOpen, KIND, notifiedOf, PARTY_LABEL, type PartyRole } from "./deadlines.ts";
1818 import type { DealView, DeadlineView, Move, Moment, Party } from "./deals.ts";
1919
2020 export interface Agent {
@@ -101,7 +101,7 @@ const lastMove = (deadline: DeadlineView): Move | undefined => {
101101 */
102102 export function recipients(deal: DealView, deadline: DeadlineView, moment: Moment = "day_of"): Party[] {
103103 const roles = new Set<PartyRole>(
104 moment === "late" ? [deadline.owes] : [deadline.owes, ...KIND[deadline.kind].notify],
104 moment === "late" ? [deadline.owes] : [deadline.owes, ...notifiedOf(deadline)],
105105 );
106106 // A cash purchase has no loan, so a lender added by hand is not told.
107107 if (deal.cash === 1) roles.delete("lender");
@@ -391,7 +391,7 @@ export const standingOf = (moveId: number): number => moveId % SEND_SPAN;
391391 function statusWords(deal: DealView, party: Party, agent: Agent): { subject: string; body: string } {
392392 const closing = deal.deadlines.find((d) => d.kind === "closing")!;
393393 const done = deal.deadlines.filter((d) => !isOpen(d));
394 const open = deal.deadlines.filter((d) => isOpen(d) && d.id !== closing.id).sort((a, b) => a.due.localeCompare(b.due));
394 const open = deal.deadlines.filter((d) => isOpen(d) && d.id !== closing.id && !isInternal(d)).sort((a, b) => a.due.localeCompare(b.due));
395395 const owner = (d: DeadlineView): string => deal.parties.find((p) => p.role === d.owes)?.name ?? PARTY_LABEL[d.owes];
396396 const next = open.slice(0, NEXT_MAX).map((d) => `• ${d.label}: ${spoken(d.due)} (${owner(d)} · ${PARTY_LABEL[d.owes].toLowerCase()})`);
397397 const more = open.length > NEXT_MAX ? `\n• …and ${open.length - NEXT_MAX} more after that` : "";
src/routes.ts +7 −5
@@ -221,6 +221,8 @@ export const AUDIT_ROW: Schema = {
221221 };
222222 const DATE: Schema = { type: "string", format: "date" };
223223 const ROLE: Schema = { enum: ["buyer", "seller", "lender", "title", "other_agent"] };
224 /** Who owes a date: a party's role, or the agent for their own listing-agreement date. */
225 const OWER: Schema = { enum: ["buyer", "seller", "lender", "title", "other_agent", "agent"] };
224226 const CONTACT: Schema = { type: "string", deprecated: true, description: "Deprecated: the email, else the phone. Read email and phone instead; this reads for one more release." };
225227 const PARTY: Schema = {
226228 type: "object",
@@ -322,7 +324,7 @@ export const DEAL: Schema = {
322324 kind: { enum: ["earnest", "inspection", "appraisal", "financing", "title", "walkthrough", "closing", "custom"] },
323325 label: { type: "string" },
324326 due: DATE,
325 owes: ROLE,
327 owes: OWER,
326328 what: { type: "string" },
327329 done_at: { type: ["string", "null"] },
328330 done_on: { type: ["string", "null"], description: "The day it was marked done, YYYY-MM-DD in the app's local calendar; null while open. Reopening clears it." },
@@ -332,7 +334,7 @@ export const DEAL: Schema = {
332334 owes_changed: {
333335 type: ["object", "null"],
334336 description: "The latest change of Owed by: the role it had (from), who changed it (by) and the day (on). Null when it was never changed.",
335 properties: { from: ROLE, by: { type: "string" }, on: DATE },
337 properties: { from: OWER, by: { type: "string" }, on: DATE },
336338 },
337339 moves: { type: "array", items: { type: "object" } },
338340 nonBusinessDay: {
@@ -346,7 +348,7 @@ export const DEAL: Schema = {
346348 conflicts: {
347349 type: "array",
348350 description:
349 "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Empty when the deal is in order or closed.",
351 "Open dates (not Closing) due on or after the open Closing date: a slipped contingency. Also the listing agreement's end (a custom date of that label) when the open Closing falls on or after it. Empty when the deal is in order or closed.",
350352 items: {
351353 type: "object",
352354 properties: {
@@ -1795,7 +1797,7 @@ export const routes: readonly Route[] = [
17951797 },
17961798 required: ["label", "due", "owes"],
17971799 },
1798 answer: { type: "object", properties: { id: { type: "integer" }, deal_id: { type: "integer" }, kind: { type: "string" }, label: { type: "string" }, due: { type: "string", format: "date" }, owes: ROLE, what: { type: "string" }, lead_days: { type: "integer" } }, required: ["id", "deal_id", "label", "due", "owes", "lead_days"] },
1800 answer: { type: "object", properties: { id: { type: "integer" }, deal_id: { type: "integer" }, kind: { type: "string" }, label: { type: "string" }, due: { type: "string", format: "date" }, owes: OWER, what: { type: "string" }, lead_days: { type: "integer" } }, required: ["id", "deal_id", "label", "due", "owes", "lead_days"] },
17991801 },
18001802 },
18011803 {
@@ -1834,7 +1836,7 @@ export const routes: readonly Route[] = [
18341836 summary:
18351837 "Change a date: lead_days sets how many days before it is due its first reminder goes out (a whole number, 1 to 30; 400 with field lead_days otherwise; an unsent draft is drafted again for the new day, a sent one keeps its words), and owes changes which party owes it (one of the party roles; 422 otherwise, 409 for a date already done or waived). Today's and later reminders are drafted to the new party; ones already sent stay as they were. note sets the agent's working note on the date, one line of up to 200 characters, empty to clear it (400 with field note otherwise); it is internal and never reaches a client timeline, reminder or status update. time and place set when and where an inspection or a final walkthrough is: time as HH:MM on a quarter hour from 07:00 to 20:00 (the agent's local time), place one line of 1 to 200 characters; a field left out stays, blank or null clears it, and any other kind of date is refused (422 with field time). Drafts, the client timeline and the calendar file say them. Send any of them.",
18361838 body: { type: "object", properties: { lead_days: { type: "integer", minimum: 1, maximum: 30 }, owes: ROLE, note: { type: "string", maxLength: 200 }, time: { type: ["string", "null"], pattern: "^(0[7-9]|1[0-9]):(00|15|30|45)$|^20:00$", description: "HH:MM on a quarter hour from 07:00 to 20:00, local time; null clears it. Inspection and walkthrough only." }, place: { type: ["string", "null"], maxLength: 200 } } },
1837 answer: { type: "object", properties: { id: { type: "integer" }, lead_days: { type: "integer" }, owes: ROLE, note: { type: "string" }, time: { type: ["string", "null"] }, place: { type: ["string", "null"] } }, required: ["id", "lead_days", "owes", "note"] },
1839 answer: { type: "object", properties: { id: { type: "integer" }, lead_days: { type: "integer" }, owes: OWER, note: { type: "string" }, time: { type: ["string", "null"] }, place: { type: ["string", "null"] } }, required: ["id", "lead_days", "owes", "note"] },
18381840 },
18391841 },
18401842 {
src/sample.test.ts +1 −1
@@ -43,7 +43,7 @@ test("a sample a person changed is not untouched", () => {
4343 const state = {
4444 sample: "9 Orchard Row",
4545 parties: 3, // lender, title, other agent
46 customs: 1,
46 customs: 2, // repair credit, listing expiry
4747 reminders: 0,
4848 doneAts: ["2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", null],
4949 dues: ["2026-10-01", "2026-10-01", "2026-10-01", "2026-10-09"],
src/sample.ts +4 −1
@@ -110,7 +110,10 @@ const SAMPLES: readonly Sample[] = [
110110 ["other_agent", "Ben Adeyemi, Lantern Realty", "[email protected]"],
111111 ],
112112 done: ["earnest", "inspection", "title"],
113 custom: [["Repair credit agreed", 5, "seller", "Signed amendment for the roof repair credit"]],
113 custom: [
114 ["Repair credit agreed", 5, "seller", "Signed amendment for the roof repair credit"],
115 ["Listing agreement expires", 14, "agent", "Closing is four days after it ends: extend the listing or move closing"],
116 ],
114117 moved: ["appraisal", 2, "Appraiser rescheduled — access to the property"],
115118 notes: [["appraisal", "Appraisal ordered, AMC says Thursday"]],
116119 },
src/suggested.test.ts +2 −2
@@ -3,7 +3,7 @@ import { afterAll, expect, test } from "bun:test";
33 import { mkdtempSync } from "node:fs";
44 import { tmpdir } from "node:os";
55 import { join } from "node:path";
6 import { DEFAULT_LEAD, SUGGESTED_DATES, leadOfLabel } from "./deadlines.ts";
6 import { DEFAULT_LEAD, SUGGESTED_DATES, leadOfLabel, suggestedFor } from "./deadlines.ts";
77 import { addDeadline, createDeal } from "./deals.ts";
88 import { openDb } from "./db.ts";
99 import { serve } from "./server.ts";
@@ -24,7 +24,7 @@ test("a deal's page offers the suggested dates in a plain datalist, escaped, and
2424 const page = await (await fetch(base + path, { headers })).text();
2525 expect(page).toContain('<datalist id="suggested-dates">');
2626 const options = [...page.matchAll(/<datalist id="suggested-dates">(.*?)<\/datalist>/gs)][0]![1]!;
27 expect([...options.matchAll(/<option value="([^"]*)"><\/option>/g)].map((m) => m[1])).toEqual(SUGGESTED_DATES.map((s) => s.label));
27 expect([...options.matchAll(/<option value="([^"]*)"><\/option>/g)].map((m) => m[1])).toEqual(suggestedFor("buyer").map((s) => s.label));
2828 expect(options).not.toMatch(/<(?!\/?option)/);
2929 expect(page).toMatch(/<label>What<input class="input" name="label"[^>]*list="suggested-dates"/);
3030 });
src/terminal.ts +3 −3
@@ -71,7 +71,7 @@ import {
7171 import { find, FIND_MAX, query } from "./find.ts";
7272 import { mayRestore, restoreSamples } from "./actions.ts";
7373 import { conflictLine } from "./order.ts";
74 import { isOpen, PARTY_LABEL, PARTY_ROLES, type PartyRole } from "./deadlines.ts";
74 import { CONTACT_ROLES, isOpen, PARTY_LABEL, type PartyRole } from "./deadlines.ts";
7575 import { agentOf, getProfile, setProfile, useDefaults, zoneOf } from "./profile.ts";
7676 import { permit } from "./contract.ts";
7777 import { exportDeals, exportName } from "./export.ts";
@@ -345,11 +345,11 @@ export function terminal(
345345 });
346346 }
347347 if (key === "a")
348 ask(deal, ["What is the date (e.g. HOA review ends)", "Date (YYYY-MM-DD)", `Owed by (${PARTY_ROLES.join(", ")})`, "Details (optional)"], ([label, due, owes, what]) =>
348 ask(deal, ["What is the date (e.g. HOA review ends)", "Date (YYYY-MM-DD)", `Owed by (${CONTACT_ROLES.join(", ")})`, "Details (optional)"], ([label, due, owes, what]) =>
349349 report(addDeadline(db, me, { dealId: deal.id, label, due, owes, what }), () => withConflicts(db, me, deal.id, `Added ${label}.`)),
350350 );
351351 if (key === "p")
352 ask(deal, [`Role (${PARTY_ROLES.join(", ")})`, "Name", "Email (optional)", "Phone (optional)"], ([role, name, email, phone]) =>
352 ask(deal, [`Role (${CONTACT_ROLES.join(", ")})`, "Name", "Email (optional)", "Phone (optional)"], ([role, name, email, phone]) =>
353353 report(addParty(db, me, { dealId: deal.id, role, name, email, phone }), `Added ${name}.`),
354354 );
355355 if (key === "D") {
src/timeline.ts +2 −1
@@ -6,6 +6,7 @@
66 */
77
88 import { appointmentLine } from "./appointment.ts";
9 import { isInternal } from "./deadlines.ts";
910 import { doneLine, spoken, urgencyOf, type Urgency } from "./dates.ts";
1011 import type { DealView } from "./deals.ts";
1112 import { guidance, type Guidance } from "./guidance.ts";
@@ -43,7 +44,7 @@ export interface TimelineRow {
4344 }
4445
4546 export function timelineRows(deal: DealView, on: string): TimelineRow[] {
46 return deal.deadlines.map((d) => {
47 return deal.deadlines.filter((d) => !isInternal(d)).map((d) => {
4748 const u = urgencyOf(d, on);
4849 const { name, role } = owner(deal, d);
4950 return { label: d.label, due: d.due, spoken: spoken(d.due), where: appointmentLine(d), role, name, status: STATUS[u].word, doneLine: u === "done" && d.done_on !== null ? doneLine(d.due, d.done_on) : "", mark: STATUS[u].mark, urgency: u, todo: guidance(d.kind, deal.side, u !== "done" && u !== "waived") };

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs