45 lines
965 B
Go
45 lines
965 B
Go
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"
|
|
)
|
|
|
|
type Route struct {
|
|
Path string
|
|
Method string
|
|
Exec func(cfg *StereoConfig) gin.HandlerFunc
|
|
}
|
|
|
|
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 {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
|
|
Name string `gorm:"not null;index"`
|
|
Owner string `gorm:"not null;index"`
|
|
Size int64 `gorm:"not null;type:bigint"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
Mime string
|
|
}
|
|
|
|
func (f *File) BeforeCreate(tx *gorm.DB) (err error) {
|
|
f.ID, err = uuid.NewV4()
|
|
return
|
|
}
|