file_system/internal/api/handlers/download_file_handler.go
2025-12-18 09:34:49 +08:00

20 lines
463 B
Go

package handlers
import (
"context"
"file-system/internal/domain/repository"
"io"
)
type DownloadFileHandler struct {
Repo repository.FileRepository
}
func NewDownloadFileHandler(repo repository.FileRepository) *DownloadFileHandler {
return &DownloadFileHandler{Repo: repo}
}
func (h *DownloadFileHandler) Handle(ctx context.Context, query DownloadFileQuery) (io.ReadCloser, error) {
return h.Repo.DownloadFile(ctx, query.BucketName, query.ObjectKey)
}