Merged in feature/docclean (pull request #55)
Doc Clean Structure * outline * isdocclean * placeholder for clean log * versionplustesting * versionplustesting * testspassed
This commit is contained in:
@@ -5,15 +5,14 @@ import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
doccleanrunner "queryorchestration/api/docCleanRunner"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/document"
|
||||
documentclean "queryorchestration/internal/document/clean"
|
||||
"queryorchestration/internal/job"
|
||||
"queryorchestration/internal/serviceconfig/queue"
|
||||
"regexp"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
@@ -55,8 +54,7 @@ type createDocumentParams struct {
|
||||
ID *pgtype.UUID
|
||||
JobID pgtype.UUID
|
||||
Hash string
|
||||
Bucket string
|
||||
Location string
|
||||
Location document.Location
|
||||
}
|
||||
|
||||
func (s *Service) getCreateParams(ctx context.Context, doc *Create) (*createDocumentParams, error) {
|
||||
@@ -75,7 +73,6 @@ func (s *Service) getCreateParams(ctx context.Context, doc *Create) (*createDocu
|
||||
ID: docID,
|
||||
JobID: database.MustToDBUUID(doc.JobID),
|
||||
Hash: doc.Hash,
|
||||
Bucket: doc.Bucket,
|
||||
Location: doc.Location,
|
||||
}, nil
|
||||
}
|
||||
@@ -101,8 +98,8 @@ func (s *Service) submitCreate(ctx context.Context, params *createDocumentParams
|
||||
|
||||
err := s.cfg.GetDBQueries().AddDocumentEntry(ctx, &repository.AddDocumentEntryParams{
|
||||
Documentid: dbid,
|
||||
Bucket: params.Bucket,
|
||||
Location: params.Location,
|
||||
Bucket: params.Location.Bucket,
|
||||
Key: params.Location.Key,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -126,10 +123,9 @@ func (s *Service) informCreate(ctx context.Context, id uuid.UUID, j *job.Job) er
|
||||
|
||||
err := s.cfg.SendToQueue(ctx, &queue.SendParams{
|
||||
QueueURL: s.cfg.GetDocumentCleanURL(),
|
||||
Body: documentclean.Create{
|
||||
Body: doccleanrunner.Create{
|
||||
ID: id,
|
||||
},
|
||||
Attributes: map[string]types.MessageAttributeValue{},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user