SurfSense/surfsense_web/features/documents/viewer/model.ts
Anish Sarkar 96d9cb6521 feat(documents): enhance document viewing and management features
- Introduced new schemas for document viewing, including `DocumentViewFileRead` and `DocumentViewManifestRead`.
- Implemented a new API endpoint to retrieve document view manifests, providing metadata for document presentation.
- Added a document viewer component to handle various document types and their respective viewing logic.
- Updated the right panel to support document viewing alongside existing features.
- Enhanced tests to cover new document viewing functionalities and ensure robust error handling.
2026-08-18 05:06:42 +05:30

21 lines
669 B
TypeScript

import { z } from "zod";
export const DocumentViewFileSchema = z.object({
file_id: z.number().int().positive(),
filename: z.string(),
mime_type: z.string(),
size_bytes: z.number().nonnegative(),
content_url: z.string(),
});
export const DocumentViewManifestSchema = z.object({
document_id: z.number().int().positive(),
title: z.string(),
document_type: z.string(),
status: z.string(),
presentation: z.enum(["original", "text", "missing_original"]),
file: DocumentViewFileSchema.nullable().optional(),
});
export type DocumentViewFile = z.infer<typeof DocumentViewFileSchema>;
export type DocumentViewManifest = z.infer<typeof DocumentViewManifestSchema>;