35d72fccbe
Feature/remove mocks * remove mocks * cleanup db migrations
31 lines
902 B
Go
31 lines
902 B
Go
// Package documentclean provides document cleaning functionality.
|
|
// Note: Text extraction pipeline has been removed. The document processing
|
|
// pipeline now ends after cleaning. See remove_texttract_and_mocks_plan.md.
|
|
package documentclean
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Clean processes a document by cleaning it. Previously this also triggered
|
|
// text extraction, but that feature has been removed.
|
|
func (s *Service) Clean(ctx context.Context, documentId uuid.UUID) error {
|
|
isclean, err := s.cfg.GetDBQueries().HasDocumentCleanEntry(ctx, documentId)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to verify if document has been cleaned: %w", err)
|
|
}
|
|
|
|
if !isclean {
|
|
err = s.clean(ctx, documentId)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to clean document: %w", err)
|
|
}
|
|
}
|
|
|
|
// Note: Text extraction has been removed. Document pipeline ends here.
|
|
return nil
|
|
}
|