Files
navidrome/persistence/library_repository.go
T
2024-05-12 21:37:42 -04:00

35 lines
759 B
Go

package persistence
import (
"context"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/model"
"github.com/pocketbase/dbx"
)
type libraryRepository struct {
ctx context.Context
}
func NewLibraryRepository(ctx context.Context, _ dbx.Builder) model.LibraryRepository {
return &libraryRepository{ctx}
}
func (r *libraryRepository) Get(int32) (*model.Library, error) {
library := hardCoded()
return &library, nil
}
func (*libraryRepository) GetAll() (model.Libraries, error) {
return model.Libraries{hardCoded()}, nil
}
func hardCoded() model.Library {
library := model.Library{ID: 0, Path: conf.Server.MusicFolder}
library.Name = "Music Library"
return library
}
var _ model.LibraryRepository = (*libraryRepository)(nil)