Add library folder validation service method
- Add HasFolders() method to LibraryService - Validates library has at least one folder before operations - Returns clear boolean result - Follows service layer architecture pattern Related: TestCollectionsBulkOperations fix
This commit is contained in:
@@ -198,3 +198,12 @@ func (s *LibraryService) GetLibraryStats(ctx context.Context, libraryID pgtype.U
|
||||
"media_count": len(mediaItems),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// HasFolders checks if a library has at least one folder configured
|
||||
func (s *LibraryService) HasFolders(ctx context.Context, libraryID pgtype.UUID) (bool, error) {
|
||||
folders, err := s.db.GetLibraryFolders(ctx, libraryID)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to check library folders: %w", err)
|
||||
}
|
||||
return len(folders) > 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user