feat: tipos UploadedFile, StorageConfig, S3Config en infra (issue 0014 fase 1)

This commit is contained in:
2026-04-18 17:10:31 +02:00
parent 95826cb14f
commit 3d47e74ec7
6 changed files with 137 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package infra
// S3Config configura la conexion a almacenamiento S3-compatible (AWS S3, MinIO, etc).
type S3Config struct {
Endpoint string `json:"endpoint"` // URL del servidor (ej: "s3.amazonaws.com", "minio.local:9000")
Bucket string `json:"bucket"` // nombre del bucket
AccessKey string `json:"access_key"` // access key id
SecretKey string `json:"secret_key"` // secret access key
Region string `json:"region"` // region (ej: "us-east-1")
UseSSL bool `json:"use_ssl"` // si true, usa https
}
+8
View File
@@ -0,0 +1,8 @@
package infra
// StorageConfig configura el almacenamiento local de archivos subidos.
type StorageConfig struct {
BaseDir string `json:"base_dir"` // directorio base para almacenar archivos
MaxFileSize int64 `json:"max_file_size"` // tamano maximo en bytes (ej: 10<<20 = 10MB)
AllowedTypes []string `json:"allowed_types"` // MIME types permitidos (ej: ["image/png", "image/jpeg", "application/pdf"])
}
+13
View File
@@ -0,0 +1,13 @@
package infra
import "time"
// UploadedFile contiene la metadata de un archivo subido y almacenado en disco o S3.
type UploadedFile struct {
Filename string `json:"filename"` // nombre original del archivo
StoredName string `json:"stored_name"` // nombre en disco (UUID-based)
Size int64 `json:"size"` // tamano en bytes
ContentType string `json:"content_type"` // MIME type detectado
Path string `json:"path"` // ruta completa en disco (o key S3)
CreatedAt time.Time `json:"created_at"` // timestamp de creacion
}