mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-02 16:37:49 +01:00
feat(database): add user_library table and library access methods
Signed-off-by: Deluan <deluan@navidrome.org> # Conflicts: # tests/mock_library_repo.go
This commit is contained in:
parent
3c1e5603d0
commit
40bbae16c4
9 changed files with 533 additions and 6 deletions
|
|
@ -39,4 +39,14 @@ func (m *MockLibraryRepo) RefreshStats(id int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// User-library association methods - mock implementations
|
||||
|
||||
func (m *MockLibraryRepo) GetUsersWithLibraryAccess(libraryID int) (model.Users, error) {
|
||||
if m.Err != nil {
|
||||
return nil, m.Err
|
||||
}
|
||||
// Mock: return empty users for now
|
||||
return model.Users{}, nil
|
||||
}
|
||||
|
||||
var _ model.LibraryRepository = &MockLibraryRepo{}
|
||||
|
|
|
|||
|
|
@ -74,3 +74,37 @@ func (u *MockedUserRepo) UpdateLastAccessAt(id string) error {
|
|||
}
|
||||
return u.Error
|
||||
}
|
||||
|
||||
// Library association methods - mock implementations
|
||||
|
||||
func (u *MockedUserRepo) GetUserLibraries(userID string) (model.Libraries, error) {
|
||||
if u.Error != nil {
|
||||
return nil, u.Error
|
||||
}
|
||||
// Mock: return empty libraries for now
|
||||
return model.Libraries{}, nil
|
||||
}
|
||||
|
||||
func (u *MockedUserRepo) SetUserLibraries(userID string, libraryIDs []int) error {
|
||||
if u.Error != nil {
|
||||
return u.Error
|
||||
}
|
||||
// Mock: do nothing for now
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *MockedUserRepo) AddUserLibrary(userID string, libraryID int) error {
|
||||
if u.Error != nil {
|
||||
return u.Error
|
||||
}
|
||||
// Mock: do nothing for now
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *MockedUserRepo) RemoveUserLibrary(userID string, libraryID int) error {
|
||||
if u.Error != nil {
|
||||
return u.Error
|
||||
}
|
||||
// Mock: do nothing for now
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue