Initial commit: party-mix-app with prefetch cache, audio preload optimizations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
79
apps/backend/internal/models/models.go
Normal file
79
apps/backend/internal/models/models.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Party struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Code string `gorm:"uniqueIndex;not null" json:"code"`
|
||||
TelegramID int64 `json:"telegram_id,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Participants []Participant `gorm:"foreignKey:PartyID" json:"participants,omitempty"`
|
||||
History []HistoryItem `gorm:"foreignKey:PartyID" json:"history,omitempty"`
|
||||
}
|
||||
|
||||
type Participant struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
PartyID string `gorm:"not null;index" json:"party_id"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
ColorBg string `json:"color_bg"`
|
||||
ColorText string `json:"color_text"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Tracks []Track `gorm:"foreignKey:ParticipantID" json:"tracks,omitempty"`
|
||||
}
|
||||
|
||||
type Track struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
ParticipantID string `gorm:"not null;index" json:"participant_id"`
|
||||
Title string `gorm:"not null" json:"title"`
|
||||
Position int `json:"position"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type HistoryItem struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
PartyID string `gorm:"not null;index" json:"party_id"`
|
||||
Title string `json:"title"`
|
||||
Artist string `json:"artist"`
|
||||
ImgURL string `json:"img_url"`
|
||||
OwnerName string `json:"owner_name"`
|
||||
OwnerColorBg string `json:"owner_color_bg"`
|
||||
OwnerColorText string `json:"owner_color_text"`
|
||||
PlayedAt time.Time `json:"played_at"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
Username string `gorm:"uniqueIndex;not null" json:"username"`
|
||||
Email string `gorm:"uniqueIndex;not null" json:"email"`
|
||||
PasswordHash string `gorm:"not null" json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type Playlist struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
UserID string `gorm:"not null;index" json:"user_id"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
IsPublic bool `gorm:"default:false" json:"is_public"`
|
||||
Tags string `gorm:"default:''" json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Tracks []PlaylistTrack `gorm:"foreignKey:PlaylistID" json:"tracks,omitempty"`
|
||||
}
|
||||
|
||||
type PlaylistTrack struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
PlaylistID string `gorm:"not null;index" json:"playlist_id"`
|
||||
Title string `gorm:"not null" json:"title"`
|
||||
Position int `json:"position"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type UserVersion struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
||||
UserID string `gorm:"not null;index:idx_user_version_track,unique" json:"user_id"`
|
||||
TrackTitle string `gorm:"not null;index:idx_user_version_track,unique" json:"track_title"`
|
||||
VersionTitle string `gorm:"not null" json:"version_title"`
|
||||
VersionArtist string `gorm:"not null" json:"version_artist"`
|
||||
VersionDuration string `gorm:"not null" json:"version_duration"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user