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:
@@ -3,19 +3,19 @@ import { getFileIcon } from './fileIcons'
|
||||
export const getPreviewType = (document) => {
|
||||
if (!document) { return null }
|
||||
const mime = (document.mimeType || '').toLowerCase()
|
||||
const path = document.path || ''
|
||||
|
||||
const check = prefix => mime.startsWith(prefix) || path.startsWith(`data:${prefix}`)
|
||||
|
||||
if (check('image/')) { return 'image' }
|
||||
if (mime === 'application/pdf' || path.startsWith('data:application/pdf')) { return 'pdf' }
|
||||
if (check('audio/')) { return 'audio' }
|
||||
if (check('video/')) { return 'video' }
|
||||
if (check('text/') || mime.includes('json') || mime.includes('xml') || path.startsWith('data:application/json')) { return 'text' }
|
||||
if (mime.startsWith('image/')) { return 'image' }
|
||||
if (mime === 'application/pdf') { return 'pdf' }
|
||||
if (mime.startsWith('audio/')) { return 'audio' }
|
||||
if (mime.startsWith('video/')) { return 'video' }
|
||||
if (mime.startsWith('text/') || mime.includes('json') || mime.includes('xml')) { return 'text' }
|
||||
return null
|
||||
}
|
||||
|
||||
export const canPreviewDocument = (document = {}) => !!getPreviewType(document)
|
||||
export const canPreviewDocument = (document = {}) => {
|
||||
if (!getPreviewType(document)) return false
|
||||
return !!(document.fileUrl || document.path)
|
||||
}
|
||||
|
||||
export const isImageDocument = (document = {}) => getPreviewType(document) === 'image'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user