model

package
v0.0.0-...-64e8138 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Title       string
	ReleaseDate time.Time
	Songs       []Song            `gorm:"constraint:OnDelete:CASCADE;"`
	Identifiers []AlbumIdentifier `gorm:"constraint:OnDelete:CASCADE;"`
}

func (*Album) BeforeCreate

func (s *Album) BeforeCreate(tx *gorm.DB) (err error)

func (*Album) GetArtistName

func (a *Album) GetArtistName() string

type AlbumIdentifier

type AlbumIdentifier struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Identifier string    `gorm:"not null"`
	AlbumID    uuid.UUID `gorm:"type:uuid;not null"`
	Album      Album
}

func (*AlbumIdentifier) BeforeCreate

func (a *AlbumIdentifier) BeforeCreate(tx *gorm.DB) (err error)

type Artist

type Artist struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Name        string
	Identifiers []ArtistIdentifier `gorm:"constraint:OnDelete:CASCADE;"`
}

func (*Artist) BeforeCreate

func (s *Artist) BeforeCreate(tx *gorm.DB) (err error)

type ArtistIdentifier

type ArtistIdentifier struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Identifier string    `gorm:"index;not null" `
	ArtistID   uuid.UUID `gorm:"type:uuid;not null"`
	Artist     Artist
}

func (*ArtistIdentifier) BeforeCreate

func (a *ArtistIdentifier) BeforeCreate(tx *gorm.DB) (err error)

type MBArtistCredit

type MBArtistCredit struct {
	ID   int    `gorm:"primaryKey"`
	Name string `gorm:"column:name"`
}

func (MBArtistCredit) TableName

func (MBArtistCredit) TableName() string

type MBRecording

type MBRecording struct {
	ID             int             `gorm:"primaryKey"`
	GID            string          `gorm:"column:gid"`
	Name           string          `gorm:"column:name"`
	ArtistCreditID int             `gorm:"column:artist_credit"`
	ArtistCredit   *MBArtistCredit `gorm:"foreignKey:ArtistCreditID;references:ID"`
	Length         int             `gorm:"column:length"`
}

func (MBRecording) TableName

func (MBRecording) TableName() string

type Playlist

type Playlist struct {
	ID        uuid.UUID `gorm:"type:uuid;primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Name           string          `gorm:"not null"`
	FolderID       uuid.UUID       `gorm:"type:uuid;index"`
	PlaylistFolder *PlaylistFolder `gorm:"foreignKey:FolderID"`
	UserID         uuid.UUID       `gorm:"type:uuid;index;not null"`

	PlaylistSongs []PlaylistSong `gorm:"foreignKey:PlaylistID;constraint:OnDelete:CASCADE;"`
}

type PlaylistFolder

type PlaylistFolder struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Name      string
	UserID    uuid.UUID  `gorm:"type:uuid;not null;index"`
	User      User       `gorm:"foreignKey:UserID"`
	ParentID  *uuid.UUID `gorm:"type:uuid;index"`
	Parent    *PlaylistFolder
	Children  []*PlaylistFolder `gorm:"foreignKey:ParentID"`
	Playlists []Playlist        `gorm:"foreignKey:FolderID;constraint:OnDelete:CASCADE;"`
}

type PlaylistSong

type PlaylistSong struct {
	PlaylistID uuid.UUID `gorm:"type:uuid;primaryKey"`
	SongID     uuid.UUID `gorm:"type:uuid;primaryKey"`

	// Order is a fractional index string for sorting
	Order string `gorm:"type:text;not null;default:''"`

	CreatedAt time.Time

	// Associations
	Playlist Playlist `gorm:"foreignKey:PlaylistID"`
	Song     Song     `gorm:"foreignKey:SongID"`
}

type RequestMail

type RequestMail struct {
	gorm.Model
	Category string
	Message  string
	UserID   uuid.UUID
	Status   RequestMailStatus
}

type RequestMailStatus

type RequestMailStatus int
const (
	RequestMailStatusPending    RequestMailStatus = iota // 0
	RequestMailStatusProcessing                          // 1
	RequestMailStatusCompleted                           // 2
	RequestMailStatusRejected                            // 3
)

type Setting

type Setting struct {
	Key   string `gorm:"primaryKey"`
	Value string
}

type Song

type Song struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	AlbumID     uuid.UUID `gorm:"type:uuid"`
	Album       Album
	Title       string           `gorm:"index"`
	Artists     []Artist         `gorm:"many2many:song_artists;constraint:OnDelete:CASCADE;"`
	SongFiles   []SongFile       `gorm:"constraint:OnDelete:CASCADE;"`
	Identifiers []SongIdentifier `gorm:"constraint:OnDelete:CASCADE;"`
}

func (*Song) BeforeCreate

func (s *Song) BeforeCreate(tx *gorm.DB) (err error)

type SongFile

type SongFile struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	SongID   uuid.UUID `gorm:"type:uuid"`
	Format   string
	Duration uint
}

func (*SongFile) BeforeCreate

func (s *SongFile) BeforeCreate(tx *gorm.DB) (err error)

func (*SongFile) FilePath

func (s *SongFile) FilePath() string

type SongIdentifier

type SongIdentifier struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Identifier string    `gorm:"not null"`
	SongID     uuid.UUID `gorm:"type:uuid;not null"`
	Song       Song
}

func (*SongIdentifier) BeforeCreate

func (a *SongIdentifier) BeforeCreate(tx *gorm.DB) (err error)

type User

type User struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Username     string     `gorm:"uniqueIndex;not null"`
	PasswordHash string     `gorm:"not null" json:"-"`
	IsAdmin      bool       `gorm:"default:false"`
	BannedUntil  *time.Time `gorm:"default:null"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL