Merged in feature/textExtractionsPart1 (pull request #192)
all schema and rest apis for text extraction support * in progress * stage 8 complete * phase 9 completed * phase 9 complete * ongoing - s3 path fix * working * optimize ci build * e2e tests * missing test
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
"queryorchestration/internal/database/repository"
|
||||
documentinit "queryorchestration/internal/document/init"
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const Name = "docInitRunner"
|
||||
@@ -41,8 +43,9 @@ func (s Runner) Process(ctx context.Context, body Body) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Get filename from documentUploads table
|
||||
// Get filename and folder_id from documentUploads table
|
||||
var filename *string
|
||||
var folderID *uuid.UUID
|
||||
upload, err := s.svc.Queries.GetDocumentUploadByKey(ctx, &repository.GetDocumentUploadByKeyParams{
|
||||
Bucket: body.Bucket,
|
||||
Key: body.Key,
|
||||
@@ -51,20 +54,25 @@ func (s Runner) Process(ctx context.Context, body Body) bool {
|
||||
slog.Error("unable to get document upload", "bucket", body.Bucket, "key", body.Key, "error", err)
|
||||
return false
|
||||
}
|
||||
if err == nil && upload.Filename != nil {
|
||||
filename = upload.Filename
|
||||
if err == nil {
|
||||
if upload.Filename != nil {
|
||||
filename = upload.Filename
|
||||
}
|
||||
folderID = upload.FolderID
|
||||
}
|
||||
|
||||
id, err := s.svc.Document.Create(ctx, &documentinit.Create{
|
||||
Key: key,
|
||||
Bucket: body.Bucket,
|
||||
Hash: body.Hash,
|
||||
Filename: filename,
|
||||
Key: key,
|
||||
Bucket: body.Bucket,
|
||||
Hash: body.Hash,
|
||||
Filename: filename,
|
||||
OriginalPath: filename, // For batch uploads, filename contains the full original path
|
||||
FolderID: folderID,
|
||||
})
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
slog.Debug("created document", "id", id, "filename", filename)
|
||||
slog.Debug("created document", "id", id, "filename", filename, "folder_id", folderID)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user