28 lines
1.2 KiB
Markdown
28 lines
1.2 KiB
Markdown
# Document Batch Processing
|
|
|
|
This directory contains the service layer for managing document batch uploads.
|
|
|
|
## Purpose
|
|
|
|
The batch service provides a business logic layer between the HTTP API handlers and the database repository for batch upload operations. It handles:
|
|
|
|
- **Model Conversion**: Translates between OpenAPI-generated types and internal database models
|
|
- **Business Logic**: Encapsulates batch-specific operations (CRUD, progress tracking)
|
|
- **Data Validation**: Manages UUID conversions, JSONB parsing, and nullable type handling
|
|
|
|
## Architecture
|
|
|
|
```
|
|
HTTP Request → API Handler → Batch Service → Database Repository → PostgreSQL
|
|
```
|
|
|
|
The service is **stateless** and **synchronous** - it does not run background processes. Actual document processing happens through the existing Runner pipeline (`storeEventRunner` → `docInitRunner` → etc.).
|
|
|
|
## Files
|
|
|
|
- `service.go` - Main batch service implementation with CRUD operations
|
|
- `service_test.go` - Unit tests using testcontainers for database integration
|
|
|
|
## Usage
|
|
|
|
The service is instantiated by API handlers in `/api/queryAPI/documents.go` to manage batch upload metadata, progress tracking, and status updates. |