Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (24)
📝 WalkthroughWalkthroughThis PR implements S3-compatible object storage integration for file uploads across both esigner and file-manager platforms. It introduces presigned upload endpoints, a new S3Service class for AWS SDK operations, modifies the File entity to add a url field and make data nullable, updates database schemas via migrations, and refactors client-side upload flows from server-side multipart to direct S3 uploads with presigned URLs. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller
participant S3Service
participant S3 as S3 Storage
participant FileService
participant Database
rect rgba(100, 150, 255, 0.5)
Note over Client,Database: Presign Upload Flow
Client->>Controller: POST /api/files/presign<br/>(filename, mimeType, size)
Controller->>S3Service: generateKey(userId, fileId, filename)
S3Service-->>Controller: key
Controller->>S3Service: generateUploadUrl(key, contentType)
S3Service-->>Controller: presigned uploadUrl
Controller-->>Client: { uploadUrl, key, fileId }
end
rect rgba(150, 200, 100, 0.5)
Note over Client,S3: Direct S3 Upload
Client->>S3: PUT uploadUrl<br/>(file data, Content-Type, x-amz-acl)
S3-->>Client: 200 OK
end
rect rgba(200, 150, 100, 0.5)
Note over Client,Database: Confirm Upload Flow
Client->>Controller: POST /api/files/confirm<br/>(key, fileId, filename, mimeType, size)
Controller->>S3Service: headObject(key)
S3Service->>S3: HEAD object
S3-->>S3Service: { contentLength, etag }
S3Service-->>Controller: metadata with md5Hash
Controller->>S3Service: getPublicUrl(key)
S3Service-->>Controller: public url
Controller->>FileService: createFileWithUrl(..., url)
FileService->>Database: save File record
Database-->>FileService: File entity
FileService-->>Controller: File
Controller-->>Client: { file metadata }
end
rect rgba(100, 200, 200, 0.5)
Note over Client,S3: Download/Preview Flow
alt file.url exists
Client->>Client: use file.url<br/>(direct redirect or open)
else file.url is null
Client->>Controller: GET /api/files/[id]/download
Controller->>FileService: getFileDataStream(fileId)
FileService->>Database: fetch File
Database-->>FileService: File record
FileService-->>Controller: Readable stream
Controller-->>Client: file data
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description of change
Change from db to object store
Issue Number
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit