fix(ocr): persist scriptType override via DocumentService transaction
OcrService.startOcr() was setting scriptType on a detached entity, silently losing the mutation. Added DocumentService.updateScriptType() with @Transactional to persist the change properly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,7 +146,7 @@ class OcrServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void startOcr_setsScriptTypeOnDocument_whenProvided() {
|
||||
void startOcr_updatesScriptType_whenProvided() {
|
||||
UUID docId = UUID.randomUUID();
|
||||
Document doc = Document.builder().id(docId).status(DocumentStatus.UPLOADED)
|
||||
.filePath("test.pdf").scriptType(ScriptType.UNKNOWN).build();
|
||||
@@ -160,6 +160,6 @@ class OcrServiceTest {
|
||||
|
||||
ocrService.startOcr(docId, ScriptType.HANDWRITING_LATIN, UUID.randomUUID());
|
||||
|
||||
assertThat(doc.getScriptType()).isEqualTo(ScriptType.HANDWRITING_LATIN);
|
||||
verify(documentService).updateScriptType(docId, ScriptType.HANDWRITING_LATIN);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user