type CategoryMedia struct {
MediaID int `gorm:"primaryKey"`
Media Media `gorm:"reference:MediaID;constraint:OnDelete:CASCADE;"`
CategoryID string `gorm:"type:uuid;primaryKey"`
Category Category `gorm:"reference:CategoryID;constraint:OnDelete:CASCADE;"`
}
type Episode struct {
Model Name string NbEpisode int NbSeason int MediaID int `gorm:"not null"`
Media Media `gorm:"reference:MediaID"`
TvShowID string `gorm:"type:uuid;not null"`
TvShow TvShow `gorm:"reference:TvShowID"`
MediaFileID string `gorm:"type:uuid;not null"`
MediaFile MediaFile `gorm:"reference:MediaFileID;constraint:OnDelete:CASCADE;"`
}
type Movie struct {
Model Name string MediaID int `gorm:"not null"`
Media Media `gorm:"reference:MediaID"`
MediaFileID string `gorm:"type:uuid;not null"`
MediaFile MediaFile `gorm:"reference:MediaFileID;constraint:OnDelete:CASCADE;"`
}
type Rating struct {
UserID string `gorm:"type:uuid;primaryKey"`
MediaID int `gorm:"primaryKey"`
Media Media `gorm:"reference:MediaID;constraint:OnDelete:CASCADE;"`
Rating int}
type TvShow struct {
Model Name string MediaID int `gorm:"not null"`
Media Media `gorm:"reference:MediaID"`
Episodes []Episode `gorm:"foreignKey:TvShowID;constraint:OnDelete:CASCADE;"`
}