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:
@@ -15,10 +15,12 @@ import (
|
||||
)
|
||||
|
||||
type Create struct {
|
||||
Bucket string
|
||||
Key objectstore.BucketKey
|
||||
Hash string
|
||||
Filename *string // Optional filename for batch processing
|
||||
Bucket string
|
||||
Key objectstore.BucketKey
|
||||
Hash string
|
||||
Filename *string // Optional filename for batch processing
|
||||
OriginalPath *string // Original path provided during upload (immutable after creation)
|
||||
FolderID *uuid.UUID // Optional folder ID if folder hierarchy was pre-created
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, doc *Create) (uuid.UUID, error) {
|
||||
@@ -48,11 +50,13 @@ func (s *Service) Create(ctx context.Context, doc *Create) (uuid.UUID, error) {
|
||||
}
|
||||
|
||||
type createDocumentParams struct {
|
||||
ID *uuid.UUID
|
||||
Hash string
|
||||
Bucket string
|
||||
Key objectstore.BucketKey
|
||||
Filename *string
|
||||
ID *uuid.UUID
|
||||
Hash string
|
||||
Bucket string
|
||||
Key objectstore.BucketKey
|
||||
Filename *string
|
||||
OriginalPath *string
|
||||
FolderID *uuid.UUID
|
||||
}
|
||||
|
||||
func (s *Service) getCreateParams(ctx context.Context, doc *Create) (*createDocumentParams, error) {
|
||||
@@ -68,11 +72,13 @@ func (s *Service) getCreateParams(ctx context.Context, doc *Create) (*createDocu
|
||||
}
|
||||
|
||||
return &createDocumentParams{
|
||||
ID: docID,
|
||||
Hash: doc.Hash,
|
||||
Key: doc.Key,
|
||||
Bucket: doc.Bucket,
|
||||
Filename: doc.Filename,
|
||||
ID: docID,
|
||||
Hash: doc.Hash,
|
||||
Key: doc.Key,
|
||||
Bucket: doc.Bucket,
|
||||
Filename: doc.Filename,
|
||||
OriginalPath: doc.OriginalPath,
|
||||
FolderID: doc.FolderID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -83,10 +89,12 @@ func (s *Service) submitCreate(ctx context.Context, params *createDocumentParams
|
||||
var dbid uuid.UUID
|
||||
if params.ID == nil {
|
||||
createid, err := s.cfg.GetDBQueries().CreateDocument(ctx, &repository.CreateDocumentParams{
|
||||
Clientid: params.Key.ClientID,
|
||||
Hash: params.Hash,
|
||||
BatchID: params.Key.BatchID,
|
||||
Filename: params.Filename,
|
||||
Clientid: params.Key.ClientID,
|
||||
Hash: params.Hash,
|
||||
BatchID: params.Key.BatchID,
|
||||
Filename: params.Filename,
|
||||
Folderid: params.FolderID,
|
||||
Originalpath: params.OriginalPath,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -52,7 +52,7 @@ func TestCreate(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id"}),
|
||||
)
|
||||
pool.ExpectBegin()
|
||||
pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil)).
|
||||
pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil), (*uuid.UUID)(nil), (*string)(nil)).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(doc.ID),
|
||||
@@ -80,6 +80,7 @@ func TestCreate(t *testing.T) {
|
||||
mock.MatchedBy(func(in *sqs.SendMessageInput) bool {
|
||||
return *in.QueueUrl == cfg.DocumentSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", doc.ID.String())
|
||||
}),
|
||||
mock.Anything,
|
||||
).
|
||||
Return(&sqs.SendMessageOutput{}, nil)
|
||||
|
||||
@@ -235,7 +236,7 @@ func TestSubmitCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
pool.ExpectBegin()
|
||||
pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil)).
|
||||
pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil), (*uuid.UUID)(nil), (*string)(nil)).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(doc.ID),
|
||||
|
||||
Reference in New Issue
Block a user