support subsonic bookmarks
This commit is contained in:
@@ -80,6 +80,7 @@ func New(path string) (*DB, error) {
|
||||
migrateMultiGenre(),
|
||||
migrateListenBrainz(),
|
||||
migratePodcast(),
|
||||
migrateBookmarks(),
|
||||
))
|
||||
if err = migr.Migrate(); err != nil {
|
||||
return nil, fmt.Errorf("migrating to latest version: %w", err)
|
||||
|
||||
@@ -211,7 +211,6 @@ func migrateMultiGenre() gormigrate.Migration {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func migrateListenBrainz() gormigrate.Migration {
|
||||
return gormigrate.Migration{
|
||||
ID: "202101081149",
|
||||
@@ -231,11 +230,23 @@ func migratePodcast() gormigrate.Migration {
|
||||
return gormigrate.Migration{
|
||||
ID: "202101111537",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
step := tx.AutoMigrate(
|
||||
return tx.AutoMigrate(
|
||||
Podcast{},
|
||||
PodcastEpisode{},
|
||||
)
|
||||
return step.Error
|
||||
).
|
||||
Error
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func migrateBookmarks() gormigrate.Migration {
|
||||
return gormigrate.Migration{
|
||||
ID: "202102032210",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
Bookmark{},
|
||||
).
|
||||
Error
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ type Podcast struct {
|
||||
ImageURL string
|
||||
ImagePath string
|
||||
Error string
|
||||
Episodes []*PodcastEpisode
|
||||
Episodes []*PodcastEpisode
|
||||
}
|
||||
|
||||
func (p *Podcast) Fullpath(podcastPath string) string {
|
||||
@@ -354,3 +354,15 @@ func (pe *PodcastEpisode) MIME() string {
|
||||
func (pe *PodcastEpisode) AudioBitrate() int {
|
||||
return pe.Bitrate
|
||||
}
|
||||
|
||||
type Bookmark struct {
|
||||
ID int `gorm:"primary_key"`
|
||||
User *User
|
||||
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
|
||||
Position int
|
||||
Comment string
|
||||
EntryIDType string
|
||||
EntryID int
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user