29 lines
893 B
Go
29 lines
893 B
Go
|
|
package models
|
||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Genre v0.10.1 F352: Taxonomie fixe des genres musicaux
|
||
|
|
type Genre struct {
|
||
|
|
Slug string `gorm:"size:50;primaryKey" json:"slug" db:"slug"`
|
||
|
|
Name string `gorm:"size:100;not null" json:"name" db:"name"`
|
||
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// TableName for Genre
|
||
|
|
func (Genre) TableName() string { return "genres" }
|
||
|
|
|
||
|
|
// TrackGenre v0.10.1: liaison track <-> genre (max 3 par track)
|
||
|
|
type TrackGenre struct {
|
||
|
|
TrackID uuid.UUID `gorm:"type:uuid;primaryKey" json:"track_id" db:"track_id"`
|
||
|
|
GenreSlug string `gorm:"size:50;primaryKey" json:"genre_slug" db:"genre_slug"`
|
||
|
|
Position int `gorm:"default:0" json:"position" db:"position"`
|
||
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// TableName for TrackGenre
|
||
|
|
func (TrackGenre) TableName() string { return "track_genres" }
|