You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The R2 infrastructure layer (internal/infrastructure/storage/r2/storage.go) exists but is unwired and incomplete. This issue covers finishing the integration end-to-end: ports interface, server wiring, upload/download handlers, and web/mobile client support.
Current state
internal/infrastructure/storage/r2/storage.go implements PresignUpload, Delete, and PublicURL using the AWS S3-compatible SDK. It references gigz/internal/application/ports.StorageService which does not yet exist.
Scope
Backend (Go)
Create internal/usecase/storage.go — define the StorageService port interface (PresignUpload, Delete, PublicURL)
Wire r2.New(...) in server.go using env vars R2_ACCOUNT_ID, R2_ACCESS_KEY, R2_SECRET_KEY, R2_BUCKET, R2_PUBLIC_URL
Add a storage_handler.go with two endpoints:
POST /storage/presign — returns a presigned PUT URL and the final public URL for a given filename + content type
Summary
The R2 infrastructure layer (
internal/infrastructure/storage/r2/storage.go) exists but is unwired and incomplete. This issue covers finishing the integration end-to-end: ports interface, server wiring, upload/download handlers, and web/mobile client support.Current state
internal/infrastructure/storage/r2/storage.goimplementsPresignUpload,Delete, andPublicURLusing the AWS S3-compatible SDK. It referencesgigz/internal/application/ports.StorageServicewhich does not yet exist.Scope
Backend (Go)
internal/usecase/storage.go— define theStorageServiceport interface (PresignUpload,Delete,PublicURL)r2.New(...)inserver.gousing env varsR2_ACCOUNT_ID,R2_ACCESS_KEY,R2_SECRET_KEY,R2_BUCKET,R2_PUBLIC_URLstorage_handler.gowith two endpoints:POST /storage/presign— returns a presigned PUT URL and the final public URL for a given filename + content typeDELETE /storage/:key— deletes an object by keybackend/.env.exampleWeb (Next.js)
lib/storage.tsutility: callsPOST /storage/presign, then PUTs the file directly to R2 from the browser using the presigned URLuseUploadhook that manages progress state and returns the final public URL on successMobile (Android / Jetpack Compose)
UploadRepositorythat calls the backend for a presigned URL then streams the file to R2Acceptance criteria
StorageServiceport interface exists ininternal/usecase/server.goand initialised from env varsPOST /storage/presignreturns a valid presigned URL; browser upload to that URL succeedsDELETE /storage/:keyremoves the object from R2R2_ACCOUNT_ID,R2_ACCESS_KEY,R2_SECRET_KEY,R2_BUCKET,R2_PUBLIC_URLinbackend/.env.examplebackend/docs/storage.mdandweb/docs/storage.mdDependencies