package created

This commit is contained in:
nquidox 2025-10-25 17:39:57 +03:00
parent 79d9ae5ab5
commit d5610fbb30
4 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,32 @@
package httpDelivery
import (
"imageStorage/internal/interfaces"
"os"
"path/filepath"
)
type service struct {
utils interfaces.Utils
}
func newService(utils interfaces.Utils) *service {
return &service{
utils: utils,
}
}
func (s *service) GetImage(userUuid, merchUuid, imgType string) (string, error) {
path := s.utils.MerchImageVolumePath(userUuid, merchUuid)
file := s.utils.FilenameFromType(imgType)
fullPath := filepath.Join(path, file)
if _, err := os.Stat(fullPath); err != nil {
if os.IsNotExist(err) {
return "", notFound
}
return "", err
}
return fullPath, nil
}