20 lines
463 B
Go
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)
|
|
}
|