Files
template-vitrine/backend/internal/modules/media/model.go
T
Xor290 919c807004
ci-api / test (push) Failing after 8m7s
ci-web / test (push) Failing after 5m5s
chore: build
2026-09-20 12:18:33 +02:00

29 lines
952 B
Go

// Package media manages uploaded files (images/videos) and abstracts the
// storage backend behind a Storage interface so the admin can switch
// between local disk and any S3-compatible bucket via configuration only.
package media
import (
"time"
"github.com/google/uuid"
)
type Media struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Filename string `gorm:"not null"`
StorageKey string `gorm:"not null"`
URL string `gorm:"not null"`
MimeType string `gorm:"not null"`
SizeBytes int64 `gorm:"not null"`
AltText string `gorm:"not null;default:''"`
// ProductID isolates each media file to the single product it was
// uploaded for (nil for media not tied to any product, e.g. contact
// link icons) -- there is no shared cross-product media library.
ProductID *uuid.UUID `gorm:"type:uuid;index"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (Media) TableName() string { return "media" }