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:
2026-02-09 14:28:53 -05:00
parent 001647cbbe
commit cd20c8e96d
+9
View File
@@ -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
}