feat: s3 support

This commit is contained in:
hexlocation 2025-06-14 17:48:05 +02:00
parent 8c7b09b8d8
commit bb52442373
6 changed files with 187 additions and 73 deletions

View file

@ -1,9 +1,12 @@
package types
import (
"context"
"time"
"github.com/gin-gonic/gin"
"github.com/gofrs/uuid"
"github.com/minio/minio-go/v7"
"gorm.io/gorm"
"stereo.cat/backend/internal/auth/client"
)
@ -16,17 +19,26 @@ type Route struct {
type StereoConfig struct {
ImagePath string
Bucket string
MinioClient *minio.Client
Router *gin.Engine
Client client.Client
Database *gorm.DB
JWTSecret string
FrontendUri string
Domain string
Context context.Context
}
type File struct {
Name string `gorm:"primaryKey"`
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Owner string `gorm:"not null;index"`
Size int64 `gorm:"not null;type:bigint"`
CreatedAt time.Time `gorm:"autoCreateTime"`
Extension string
}
func (f *File) BeforeCreate(tx *gorm.DB) (err error) {
f.ID, err = uuid.NewV4()
return
}