Merged in feature/doc_import (pull request #177)
integration of background processor * integration part 1 * feature working * fix mimetype issue
This commit is contained in:
@@ -37,6 +37,7 @@ func (s *Controllers) UploadDocument(ctx echo.Context, clientId ClientID) error
|
||||
err = s.svc.DocumentUpload.Upload(ctx.Request().Context(), documentupload.File{
|
||||
ClientID: clientId,
|
||||
Content: src,
|
||||
Filename: file.Filename,
|
||||
})
|
||||
if err != nil {
|
||||
slog.Error("unable to get form data", "error", err)
|
||||
@@ -185,6 +186,15 @@ func (s *Controllers) UploadDocumentBatch(ctx echo.Context, clientId ClientID) e
|
||||
"client_id", clientId,
|
||||
)
|
||||
|
||||
// Signal background runner to process new batch
|
||||
if runner := s.cfg.GetBackgroundRunner(); runner != nil {
|
||||
if err := runner.Signal(); err != nil {
|
||||
slog.Warn("Failed to signal background runner", "error", err, "batch_id", batchID)
|
||||
} else {
|
||||
slog.Info("Background runner signaled for batch processing", "batch_id", batchID)
|
||||
}
|
||||
}
|
||||
|
||||
// Return 202 Accepted with batch ID and status URL
|
||||
statusUrl := fmt.Sprintf("/clients/%s/documents/batches/%s", clientId, batchID)
|
||||
response := BatchUploadResponse{
|
||||
|
||||
Reference in New Issue
Block a user