@simonarcher/fika-types 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bean-scans.d.ts +58 -0
- package/package.json +1 -1
package/dist/bean-scans.d.ts
CHANGED
|
@@ -46,6 +46,64 @@ export interface BeanScanAiDraft {
|
|
|
46
46
|
latencyMs: number;
|
|
47
47
|
extractedAt: string;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* FIK-187 — admin scan log + FIK-186 user scan history list shape.
|
|
51
|
+
*
|
|
52
|
+
* Returned by:
|
|
53
|
+
* GET /admin/bean-scans (admin-only, all users)
|
|
54
|
+
* GET /bean-scans/me (caller-only, pinned to res.locals.uid)
|
|
55
|
+
*
|
|
56
|
+
* Carries enough to render a list row without a per-row catalog lookup —
|
|
57
|
+
* the top candidate is denormalised in. The full `candidates` array,
|
|
58
|
+
* `ai_inferred` payload, and `device_meta` are returned only on the
|
|
59
|
+
* detail endpoints.
|
|
60
|
+
*/
|
|
61
|
+
export interface BeanScanListItem {
|
|
62
|
+
id: string;
|
|
63
|
+
userId: string;
|
|
64
|
+
photoUrl: string;
|
|
65
|
+
ocrText?: string;
|
|
66
|
+
action: BeanScanAction;
|
|
67
|
+
matchedBeanId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Denormalised matched-bean fields, hydrated server-side via a batched
|
|
70
|
+
* coffee_beans + roasters lookup against `matchedBeanId`. Set when the
|
|
71
|
+
* scan resolved to a real catalog bean — i.e. action ∈ {saved, tried}
|
|
72
|
+
* always, and action === 'created_new' once the curator approves the
|
|
73
|
+
* submission. While a created_new submission is still pending, these
|
|
74
|
+
* remain undefined; clients use that to distinguish "Submitted /
|
|
75
|
+
* Pending review" from "Approved / Now in catalog".
|
|
76
|
+
*/
|
|
77
|
+
matchedBeanName?: string;
|
|
78
|
+
matchedRoasterName?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Denormalised top candidate, derived server-side from the persisted
|
|
81
|
+
* `candidates` jsonb. Lets the list render a meaningful primary line
|
|
82
|
+
* without a join. May be undefined when the matcher returned zero
|
|
83
|
+
* candidates (e.g. empty OCR text).
|
|
84
|
+
*/
|
|
85
|
+
topCandidate?: {
|
|
86
|
+
beanName: string;
|
|
87
|
+
roasterName: string;
|
|
88
|
+
score: number;
|
|
89
|
+
};
|
|
90
|
+
/** True when bean_scans.ai_inferred IS NOT NULL. */
|
|
91
|
+
hasAiInferred: boolean;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
resolvedAt?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Cursor-paginated list response shared by both endpoints.
|
|
97
|
+
*
|
|
98
|
+
* `nextCursor` is the ISO `created_at` of the oldest item in this page —
|
|
99
|
+
* caller passes it as `?before=<cursor>` on the next request. Null when
|
|
100
|
+
* exhausted.
|
|
101
|
+
*/
|
|
102
|
+
export interface BeanScanListResponse {
|
|
103
|
+
success: true;
|
|
104
|
+
scans: BeanScanListItem[];
|
|
105
|
+
nextCursor: string | null;
|
|
106
|
+
}
|
|
49
107
|
/**
|
|
50
108
|
* One row per user scan event. Powers the bag-scan loop: photograph →
|
|
51
109
|
* OCR + photo similarity → top-N candidate beans → user picks (or rejects).
|