package models import ( "time" "github.com/google/uuid" "gorm.io/gorm" ) // TrackStem represents a stem file (kick, snare, bass, etc.) for a track // v0.10.7 F482: Stem sharing type TrackStem struct { ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id" db:"id"` TrackID uuid.UUID `gorm:"type:uuid;not null" json:"track_id" db:"track_id"` Name string `gorm:"size:100;not null" json:"name" db:"name"` FilePath string `gorm:"size:500;not null" json:"file_path" db:"file_path"` Format string `gorm:"size:10;not null" json:"format" db:"format"` SizeBytes int64 `gorm:"not null;default:0" json:"size_bytes" db:"size_bytes"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at" db:"created_at"` DeletedAt gorm.DeletedAt `json:"-" db:"deleted_at"` Track Track `gorm:"foreignKey:TrackID;constraint:OnDelete:CASCADE" json:"-"` } // TableName defines the table name for GORM func (TrackStem) TableName() string { return "track_stems" } // BeforeCreate generates UUID if not set func (m *TrackStem) BeforeCreate(tx *gorm.DB) error { if m.ID == uuid.Nil { m.ID = uuid.New() } return nil }