actual state

This commit is contained in:
2026-07-29 14:50:11 -05:00
parent c9202d0b80
commit 96a37a495e
10 changed files with 561 additions and 117 deletions

View File

@@ -92,6 +92,7 @@ export interface Deal {
status: DealStatus;
follow_up_at: Day | null;
note_count: number;
todo_count: number;
business: { id: string; name: string; status: BusinessStatus };
}
@@ -287,10 +288,21 @@ export interface RefreshResult {
pages: number;
seen: number;
stored: number;
/** Of `stored`, how many used the pre-rename title format. */
legacy_stored: number;
}
export interface InboxCounts {
pending: number;
signed: number;
declined: number;
all: number;
}
export interface Inbox {
requests: InboxRow[];
/** Per status over the whole matching set, not just the rows shipped. */
counts: InboxCounts;
/** ISO timestamp of the last completed background refresh, null if never. */
last_refresh_at: string | null;
refresh_state: RefreshState;
@@ -300,6 +312,8 @@ export interface Inbox {
last_sync_at: string | null;
sync_state: RefreshState;
last_sync_result: SyncResult | null;
/** ISO date the mirror actually reaches back to, null if never walked. */
covers_from: string | null;
}
export interface ImportResult {
@@ -370,6 +384,8 @@ const qs = (params: Record<string, string | undefined>) =>
export const api = {
me: () => request<Staff>('/api/me'),
staff: () => request<Staff[]>('/api/staff'),
/** An existing name is reactivated rather than rejected. */
createStaff: (name: string) => post<Staff>('/api/staff', { name }),
login: (staffId: string) => post<{ ok: boolean; staff: Staff }>('/api/login', { staff_id: staffId }),
logout: () => post<{ ok: boolean }>('/api/logout'),
businesses: (status: BusinessStatus | '', search: string) =>
@@ -401,6 +417,7 @@ export const api = {
patch<NdaRound>(`/api/ndas/${id}`, body),
addDeal: (ndaId: string, businessId: string) =>
post<Deal>(`/api/ndas/${ndaId}/deals`, { business_id: businessId }),
deleteDeal: (id: string) => del<{ ok: boolean }>(`/api/deals/${id}`),
setDealStatus: (id: string, status: DealStatus, comment?: string) =>
post<{ id: string; status: DealStatus; follow_up_at: Day | null }>(
`/api/deals/${id}/status`,
@@ -439,7 +456,8 @@ export const api = {
}),
/** Reads the mirrored requests out of the database — never calls Dropbox. */
ndaInbox: (since: string) => request<Inbox>(`/api/nda-inbox?${qs({ since })}`),
ndaInbox: (since: string, status?: InboxStatus | '', q?: string) =>
request<Inbox>(`/api/nda-inbox?${qs({ since, status, q })}`),
/**
* Starts the background walk; resolves as soon as it is queued. Passing
* `since` makes the server re-read that whole window — leave it out for the