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:
Jay Brown
2025-11-26 19:23:42 +00:00
parent 2b43799f56
commit c45e1dd427
67 changed files with 16120 additions and 817 deletions
+20 -57
View File
@@ -36,11 +36,8 @@ func TestUploadDocument(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: "client_id",
Name: "client_name",
})
require.NoError(t, err)
// Use test helper to create client with root folder
test.CreateTestClient(t, cfg, "client_id", "client_name")
var buf bytes.Buffer
writer := multipart.NewWriter(&buf)
@@ -71,11 +68,8 @@ func TestListDocumentsByClientId(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: "client_id",
Name: "client_name",
})
require.NoError(t, err)
// Use test helper to create client with root folder
test.CreateTestClient(t, cfg, "client_id", "client_name")
docId, err := cfg.GetDBQueries().CreateDocument(t.Context(), &repository.CreateDocumentParams{
Clientid: "client_id",
Hash: "hash",
@@ -104,11 +98,8 @@ func TestGetDocument(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: "client_id",
Name: "client_name",
})
require.NoError(t, err)
// Use test helper to create client with root folder
test.CreateTestClient(t, cfg, "client_id", "client_name")
docId, err := cfg.GetDBQueries().CreateDocument(t.Context(), &repository.CreateDocumentParams{
Clientid: "client_id",
Hash: "hash",
@@ -137,13 +128,9 @@ func TestListDocumentBatches(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client
// Create test client with root folder
clientID := "test_client_list"
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Batch List",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Batch List")
// Create test batch
batchID, err := cfg.GetDBQueries().CreateBatchUpload(t.Context(), &repository.CreateBatchUploadParams{
@@ -188,13 +175,9 @@ func TestUploadDocumentBatch(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client
// Create test client with root folder
clientID := "test_client_upload"
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Batch Upload",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Batch Upload")
// Create multipart form with ZIP file
var buf bytes.Buffer
@@ -227,13 +210,9 @@ func TestGetDocumentBatch(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client
// Create test client with root folder
clientID := "test_client_get"
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Batch Get",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Batch Get")
// Create test batch
batchID, err := cfg.GetDBQueries().CreateBatchUpload(t.Context(), &repository.CreateBatchUploadParams{
@@ -262,13 +241,9 @@ func TestCancelDocumentBatch(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client
// Create test client with root folder
clientID := "test_client_cancel"
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Batch Cancel",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Batch Cancel")
// Create test batch
batchID, err := cfg.GetDBQueries().CreateBatchUpload(t.Context(), &repository.CreateBatchUploadParams{
@@ -303,13 +278,9 @@ func TestUploadDocumentBatch_Part1_Success(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client with unique ID
// Create test client with unique ID and root folder
clientID := fmt.Sprintf("test_client_part1_%d", time.Now().UnixNano())
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Part1",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Part1")
// Create test ZIP file with 3 PDFs (test1.pdf, test2.pdf, test3.pdf)
zipContent := createTestZIPFile(t, 3)
@@ -385,13 +356,9 @@ func TestUploadDocumentBatch_Part1_InvalidFile(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client with unique ID
// Create test client with unique ID and root folder
clientID := fmt.Sprintf("test_client_invalid_%d", time.Now().UnixNano())
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client Invalid",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client Invalid")
// Create invalid file (not ZIP)
body := &bytes.Buffer{}
@@ -431,13 +398,9 @@ func TestUploadDocumentBatch_Part1_TooLarge(t *testing.T) {
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc, cfg)
// Create test client with unique ID
// Create test client with unique ID and root folder
clientID := fmt.Sprintf("test_client_toolarge_%d", time.Now().UnixNano())
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
Clientid: clientID,
Name: "Test Client TooLarge",
})
require.NoError(t, err)
test.CreateTestClient(t, cfg, clientID, "Test Client TooLarge")
// Create oversized ZIP file
body := &bytes.Buffer{}