Associate main entities with library

This commit is contained in:
Deluan
2024-05-07 17:52:13 +02:00
committed by Deluan Quintão
parent 477bcaee58
commit 478c709a64
14 changed files with 153 additions and 135 deletions
+3 -11
View File
@@ -15,12 +15,13 @@ import (
)
func initialSetup(ds model.DataStore) {
ctx := context.TODO()
_ = ds.WithTx(func(tx model.DataStore) error {
if err := createOrUpdateMusicFolder(ds); err != nil {
if err := ds.Library(ctx).StoreMusicFolder(); err != nil {
return err
}
properties := ds.Property(context.TODO())
properties := ds.Property(ctx)
_, err := properties.Get(consts.InitialSetupFlagKey)
if err == nil {
return nil
@@ -116,12 +117,3 @@ func checkExternalCredentials() {
}
}
}
func createOrUpdateMusicFolder(ds model.DataStore) error {
lib := model.Library{ID: 1, Name: "Music Library", Path: conf.Server.MusicFolder}
err := ds.Library(context.TODO()).Put(&lib)
if err != nil {
log.Error("Could not access Library table", err)
}
return err
}