veza/veza-backend-api/internal/models/track_stem.go
senke 871a0f2a05
Some checks failed
Backend API CI / test-integration (push) Failing after 0s
Frontend CI / test (push) Failing after 0s
Storybook Audit / Build & audit Storybook (push) Failing after 0s
Backend API CI / test-unit (push) Failing after 0s
feat(v0.10.7): Collaboration Temps Réel F481-F483
- F481: Co-listening sessions (WebSocket sync, ListenTogether page)
- F482: Stem sharing (upload/list/download wav,aiff,flac)
- F483: Collaborative rooms (type collaborative, max 10, invite-only)
- Roadmap: v0.10.7 → DONE
2026-03-10 13:34:16 +01:00

36 lines
1.1 KiB
Go

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
}