mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 00:12:18 +00:00
feat(documents): expose content-index provenance on the document DTO
Surface the content-search index's source (vision vs local extraction) on the list + detail DTO so the vault UI can tell an AI-read document from a locally-indexed one. Threads the source through both read paths and the serialisers, regenerates the OpenAPI contract, and adds a narrowing helper for the free-String column.
This commit is contained in:
1 parent
d7ff74bb2e
commit
bb0ebb1dce
9 files changed
+108
-14
No files matched your search
@@ -19,6 +19,7 @@ import type {
|
||||
import { servingClassFor } from "@/lib/documents/upload-policy";
|
||||
import type {
|
||||
DocumentConditionLinkDto,
|
||||
DocumentContentIndexSourceValue,
|
||||
ExtractedFactDto,
|
||||
FactData,
|
||||
FactProvenance,
|
||||
@@ -135,6 +136,7 @@ export function serialiseDocument(
|
||||
counts: { factCount: number; pendingCount: number },
|
||||
conditionLinks: DocumentConditionLinkDto[] = [],
|
||||
hasContentIndex = false,
|
||||
contentIndexSource: DocumentContentIndexSourceValue | null = null,
|
||||
): InboundDocumentDto {
|
||||
return {
|
||||
id: doc.id,
|
||||
@@ -157,6 +159,7 @@ export function serialiseDocument(
|
||||
conditionLinks,
|
||||
servingClass: servingClassFor(doc.mimeType),
|
||||
hasContentIndex,
|
||||
contentIndexSource: hasContentIndex ? contentIndexSource : null,
|
||||
createdAt: doc.createdAt.toISOString(),
|
||||
updatedAt: doc.updatedAt.toISOString(),
|
||||
};
|
||||
@@ -183,6 +186,7 @@ export function serialiseDocumentDetail(
|
||||
facts: ExtractedFact[],
|
||||
conditionLinks: DocumentConditionLinkDto[] = [],
|
||||
hasContentIndex = false,
|
||||
contentIndexSource: DocumentContentIndexSourceValue | null = null,
|
||||
): InboundDocumentDetailDto {
|
||||
const pendingCount = facts.filter((f) => f.status === "PENDING").length;
|
||||
// `factCount` excludes REJECTED facts (a rejected fact is discarded, not part
|
||||
@@ -194,6 +198,7 @@ export function serialiseDocumentDetail(
|
||||
{ factCount, pendingCount },
|
||||
conditionLinks,
|
||||
hasContentIndex,
|
||||
contentIndexSource,
|
||||
),
|
||||
facts: facts.map(serialiseFact),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user