@simonarcher/fika-types 2.2.0 → 2.3.0

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.
@@ -46,6 +46,53 @@ 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 top candidate, derived server-side from the persisted
70
+ * `candidates` jsonb. Lets the list render a meaningful primary line
71
+ * without a join. May be undefined when the matcher returned zero
72
+ * candidates (e.g. empty OCR text).
73
+ */
74
+ topCandidate?: {
75
+ beanName: string;
76
+ roasterName: string;
77
+ score: number;
78
+ };
79
+ /** True when bean_scans.ai_inferred IS NOT NULL. */
80
+ hasAiInferred: boolean;
81
+ createdAt: string;
82
+ resolvedAt?: string;
83
+ }
84
+ /**
85
+ * Cursor-paginated list response shared by both endpoints.
86
+ *
87
+ * `nextCursor` is the ISO `created_at` of the oldest item in this page —
88
+ * caller passes it as `?before=<cursor>` on the next request. Null when
89
+ * exhausted.
90
+ */
91
+ export interface BeanScanListResponse {
92
+ success: true;
93
+ scans: BeanScanListItem[];
94
+ nextCursor: string | null;
95
+ }
49
96
  /**
50
97
  * One row per user scan event. Powers the bag-scan loop: photograph →
51
98
  * OCR + photo similarity → top-N candidate beans → user picks (or rejects).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonarcher/fika-types",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Shared TypeScript types for Fika projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",