navigation

This commit is contained in:
2026-08-07 19:20:16 +02:00
parent 5810c4c94f
commit ff6ef46cd4
78 changed files with 681 additions and 282 deletions
@@ -0,0 +1,73 @@
package database
import (
"context"
"io"
"net/url"
"time"
"trankilou.fr/lassistanoque/backend/internal/domain"
)
type DatabaseStorageProvider struct {
repo domain.FileRepository
}
func NewDatabaseStorageProvider(repo domain.FileRepository) *DatabaseStorageProvider {
return &DatabaseStorageProvider{repo}
}
func (p *DatabaseStorageProvider) EnsureBucket(
ctx context.Context,
bucketName string,
) error {
return nil
}
func (p *DatabaseStorageProvider) PutObject(
ctx context.Context,
reader io.Reader,
bucketName string,
objectName string,
filePath string,
contentType string,
) error {
return nil
}
func (p *DatabaseStorageProvider) GetObject(
ctx context.Context,
bucketName string,
objectName string,
filePath string,
) (io.ReadCloser, error) {
return nil, nil
}
func (p *DatabaseStorageProvider) DeleteObject(
ctx context.Context,
bucketName string,
objectName string,
filePath string,
) error {
return nil
}
func (p *DatabaseStorageProvider) ExistsObject(
ctx context.Context,
bucketName string,
objectName string,
filePath string,
) (bool, error) {
return false, nil
}
func (p *DatabaseStorageProvider) GetPresignedURL(
ctx context.Context,
bucketName string,
objectName string,
filePath string,
Expiry time.Time,
) (*url.URL, error) {
parsed, _ := url.Parse("https://localhost")
return parsed, nil
}
+20
View File
@@ -0,0 +1,20 @@
package file
import (
"fmt"
"trankilou.fr/lassistanoque/backend/internal/adapter/file/database"
"trankilou.fr/lassistanoque/backend/internal/config"
"trankilou.fr/lassistanoque/backend/internal/domain"
"trankilou.fr/lassistanoque/backend/internal/service/storage"
)
func GetStorageProvider(repository domain.FileRepository) (storage.StorageProvider, error) {
cfg := config.GetConfig()
switch cfg.StorageType {
case "database":
return database.NewDatabaseStorageProvider(repository), nil
default:
}
return nil, fmt.Errorf("Storage %s not implemented", cfg.StorageType)
}