doc detail use it this way

This commit is contained in:
shamoon committed 2026-10-20 14:00:25 -07:00
1 parent bbdc016a32
commit f0597a7c54
8 files changed
+168 -20

No files matched your search

@@ -563,6 +563,20 @@ describe(`DocumentService`, () => {
req.flush('task-id')
})
it('should call appropriate api endpoint for running zone OCR', () => {
const url = `${environment.apiBaseUrl}${endpoint}/${documents[0].id}/run-zone-ocr/`
subscription = service.runZoneOcr(documents[0].id).subscribe()
let req = httpTestingController.expectOne(url)
expect(req.request.method).toEqual('POST')
expect(req.request.body).toEqual({})
req.flush({ status: 'completed', results: [] })
subscription = service.runZoneOcr(documents[0].id, 3).subscribe()
req = httpTestingController.expectOne(url)
expect(req.request.body).toEqual({ template: 3 })
req.flush({ status: 'completed', results: [] })
})
})
it('should construct sort fields respecting permissions', () => {
@@ -367,10 +367,13 @@ export class DocumentService extends AbstractPaperlessService<Document> {
})
}
runZoneOcr(id: number): Observable<OcrZoneRunResponse> {
runZoneOcr(
id: number,
templateId: number | null = null
): Observable<OcrZoneRunResponse> {
return this.http.post<OcrZoneRunResponse>(
this.getResourceUrl(id, 'run-zone-ocr'),
{}
templateId ? { template: templateId } : {}
)
}