Merged in feature/richname (pull request #112)

Standardised rich name for Files

* tests
This commit is contained in:
Michael McGuinness
2025-04-03 19:17:24 +00:00
parent 1d49313a9f
commit 60812aba91
31 changed files with 744 additions and 601 deletions
+6 -8
View File
@@ -29,10 +29,9 @@ func New(validator *validator.Validate, svc *Services) Runner {
}
type Body struct {
Bucket string `json:"bucket" validate:"required"`
Key string `json:"key" validate:"required"`
Hash string `json:"hash" validate:"required"`
ClientID string `json:"clientId" validate:"required"`
Bucket string `json:"bucket" validate:"required"`
Key string `json:"key" validate:"required"`
Hash string `json:"hash" validate:"required"`
}
func (s Runner) Process(ctx context.Context, body Body) bool {
@@ -43,10 +42,9 @@ func (s Runner) Process(ctx context.Context, body Body) bool {
}
err = s.svc.Text.Process(ctx, &documenttext.ProcessParams{
Bucket: body.Bucket,
Key: key,
Hash: body.Hash,
ClientID: body.ClientID,
Bucket: body.Bucket,
Key: key,
Hash: body.Hash,
})
if err != nil {
slog.Error("unable to process", "bucket", body.Bucket, "key", body.Key, "hash", body.Hash, "error", err)
+8 -10
View File
@@ -72,14 +72,13 @@ func TestDocTextProcessRunner(t *testing.T) {
key := objectstore.BucketKey{
ClientID: docinfo.ClientID,
Location: objectstore.TextTextract,
Filename: triggerId.String(),
EntityID: triggerId,
CreatedAt: time.Now().UTC(),
}
doc := Body{
Bucket: bucketName,
Key: key.String(),
Hash: docinfo.Hash,
ClientID: docinfo.ClientID,
Bucket: bucketName,
Key: key.String(),
Hash: docinfo.Hash,
}
pool.ExpectQuery("name: GetDocumentTextTrigger :one").WithArgs(triggerId).WillReturnRows(
@@ -139,14 +138,13 @@ func TestDocTextProcessRunner(t *testing.T) {
key := objectstore.BucketKey{
ClientID: docinfo.ClientID,
Location: objectstore.TextTextract,
Filename: triggerId.String(),
EntityID: triggerId,
CreatedAt: time.Now().UTC(),
}
doc := Body{
Bucket: bucketName,
Key: key.String(),
Hash: docinfo.Hash,
ClientID: docinfo.ClientID,
Bucket: bucketName,
Key: key.String(),
Hash: docinfo.Hash,
}
pool.ExpectQuery("name: GetDocumentTextTrigger :one").WithArgs(triggerId).