feat(document): add server-computed hasTranscription to detail payload (#697)
getDocumentById now populates a transient hasTranscription boolean so the document detail page can gate the transcription entry control at first paint (no client store, no full block fetch, no layout shift). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,26 @@ class DocumentServiceTest {
|
||||
assertThat(documentService.getDocumentById(id)).isEqualTo(doc);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDocumentById_setsHasTranscriptionTrue_whenBlocksExist() {
|
||||
UUID id = UUID.randomUUID();
|
||||
Document doc = Document.builder().id(id).title("Test").build();
|
||||
when(documentRepository.findById(id)).thenReturn(Optional.of(doc));
|
||||
when(transcriptionBlockQueryService.hasBlocks(id)).thenReturn(true);
|
||||
|
||||
assertThat(documentService.getDocumentById(id).isHasTranscription()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDocumentById_setsHasTranscriptionFalse_whenNoBlocksExist() {
|
||||
UUID id = UUID.randomUUID();
|
||||
Document doc = Document.builder().id(id).title("Test").build();
|
||||
when(documentRepository.findById(id)).thenReturn(Optional.of(doc));
|
||||
when(transcriptionBlockQueryService.hasBlocks(id)).thenReturn(false);
|
||||
|
||||
assertThat(documentService.getDocumentById(id).isHasTranscription()).isFalse();
|
||||
}
|
||||
|
||||
// ─── updateDocument ───────────────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user