Bloc A - Code mort: - Suppression Studio (components, views, features) - Suppression gamification + services mock (projectService, storageService, gamificationService) - Mise à jour Sidebar, Navbar, locales Bloc B - Frontend: - Suppression modal.tsx deprecated, Modal.stories (doublon Dialog) - Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true - Suppression 19 tests orphelins, retrait exclusions vitest.config Bloc C - Backend: - Extraction routes_auth.go depuis router.go Bloc D - Rust: - Suppression security_legacy.rs (code mort, patterns déjà dans security/)
43 lines
1.7 KiB
Go
43 lines
1.7 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// LiveStream represents a live stream metadata record
|
|
type LiveStream struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id" db:"id"`
|
|
UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id" db:"user_id"`
|
|
Title string `gorm:"size:200;not null" json:"title" db:"title"`
|
|
Description string `gorm:"type:text" json:"description" db:"description"`
|
|
Category string `gorm:"size:100" json:"category" db:"category"`
|
|
ThumbnailURL string `gorm:"size:500" json:"thumbnailUrl" db:"thumbnail_url"`
|
|
StreamKey string `gorm:"size:100" json:"-" db:"stream_key"`
|
|
StreamerName string `gorm:"size:100" json:"streamer" db:"streamer_name"`
|
|
IsLive bool `gorm:"default:false" json:"isLive" db:"is_live"`
|
|
StartedAt *time.Time `json:"startedAt" db:"started_at"`
|
|
EndedAt *time.Time `json:"endedAt" db:"ended_at"`
|
|
ViewerCount int `gorm:"default:0" json:"viewers" db:"viewer_count"`
|
|
Tags []string `gorm:"type:jsonb;default:'[]'" json:"tags" db:"tags"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" db:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `json:"-" db:"deleted_at"`
|
|
|
|
User *User `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE" json:"-"`
|
|
}
|
|
|
|
// TableName defines the table name for GORM
|
|
func (LiveStream) TableName() string {
|
|
return "live_streams"
|
|
}
|
|
|
|
// BeforeCreate hook for GORM to generate UUID
|
|
func (m *LiveStream) BeforeCreate(tx *gorm.DB) error {
|
|
if m.ID == uuid.Nil {
|
|
m.ID = uuid.New()
|
|
}
|
|
return nil
|
|
}
|