Implements cloud-based file storage for plant photos, documents, and certificates: Storage Layer: - Multi-provider support (AWS S3, Cloudflare R2, MinIO, local filesystem) - S3-compatible provider with presigned URL generation - Local storage provider for development with signed URL verification - Configurable via environment variables Image Processing: - Automatic thumbnail generation (150x150, 300x300, 600x600, 1200x1200) - WebP conversion for optimized file sizes - EXIF data extraction for image metadata - Image optimization with Sharp API Endpoints: - POST /api/upload/image - Upload images with automatic processing - POST /api/upload/document - Upload documents (PDF, DOC, DOCX) - POST /api/upload/presigned - Get presigned URLs for direct uploads - GET/DELETE /api/upload/[fileId] - File management UI Components: - ImageUploader - Drag & drop image upload with preview - PhotoGallery - Grid gallery with lightbox view - DocumentUploader - Document upload with file type icons - ProgressBar - Animated upload progress indicator Database: - FileStore service with in-memory storage (Prisma schema ready for Agent 2) - File metadata tracking with soft delete support - Category-based file organization
34 lines
807 B
TypeScript
34 lines
807 B
TypeScript
/**
|
|
* Storage Module for LocalGreenChain
|
|
* Agent 3: File Upload & Storage System
|
|
*
|
|
* Main entry point for file storage functionality
|
|
*/
|
|
|
|
// Types
|
|
export * from './types';
|
|
|
|
// Configuration
|
|
export { getStorageConfig, storageConfig } from './config';
|
|
|
|
// Services
|
|
export { getUploadService, UploadService } from './uploadService';
|
|
export { ImageProcessor } from './imageProcessor';
|
|
export { getFileStore, FileStore } from './fileStore';
|
|
|
|
// Providers
|
|
export { S3StorageProvider } from './providers/s3';
|
|
export { LocalStorageProvider } from './providers/local';
|
|
|
|
// Re-export commonly used types for convenience
|
|
export type {
|
|
FileMetadata,
|
|
FileCategory,
|
|
UploadOptions,
|
|
UploadResult,
|
|
PresignedUrlRequest,
|
|
PresignedUrlResponse,
|
|
ImageSize,
|
|
StorageProvider,
|
|
StorageConfig,
|
|
} from './types';
|