feat(documents): migrate storage to filesystem, add server-side pagination
- Replace Base64 data URIs with file-based storage served via dedicated endpoints - Add DocumentPreviewModal navigation, DocumentThumbnail fileUrl support - Refactor documents page with server-side pagination, search, sort and filters - Update all components to use fileUrl/downloadUrl instead of raw path - Add pagination composable support (total, page, itemsPerPage, attachmentFilter) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,8 @@ type GenericDocument = {
|
||||
filename?: string | null;
|
||||
mimeType?: string | null;
|
||||
path?: string | null;
|
||||
fileUrl?: string | null;
|
||||
downloadUrl?: string | null;
|
||||
size?: number | null;
|
||||
};
|
||||
|
||||
@@ -52,7 +54,7 @@ const normalizedDocument = computed(() => props.document ?? null);
|
||||
|
||||
const canRenderImage = computed(() => {
|
||||
const doc = normalizedDocument.value;
|
||||
return !!(doc && isImageDocument(doc) && doc.path);
|
||||
return !!(doc && isImageDocument(doc) && (doc.fileUrl || doc.path));
|
||||
});
|
||||
|
||||
const canRenderPdf = computed(() => {
|
||||
@@ -73,13 +75,14 @@ const appendPdfViewerParams = (src: string) => {
|
||||
|
||||
const previewSrc = computed(() => {
|
||||
const doc = normalizedDocument.value;
|
||||
if (!doc || !doc.path) {
|
||||
const url = doc?.fileUrl || doc?.path;
|
||||
if (!doc || !url) {
|
||||
return '';
|
||||
}
|
||||
if (isPdfDocument(doc)) {
|
||||
return appendPdfViewerParams(doc.path);
|
||||
return appendPdfViewerParams(url);
|
||||
}
|
||||
return doc.path;
|
||||
return url;
|
||||
});
|
||||
|
||||
const thumbnailClass = computed(() => (canRenderImage.value || canRenderPdf.value ? 'h-20 w-16' : 'h-16 w-16'));
|
||||
|
||||
Reference in New Issue
Block a user