#407 delete ocr queued items api
This commit is contained in:
parent
a55da57ea4
commit
ae8d991528
@ -1423,6 +1423,22 @@ namespace RMuseum.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset ocr queue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("ocr/queue")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> ResetOCRQueueAsync()
|
||||
{
|
||||
var res = await _pdfService.ResetOCRQueueAsync();
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// fill book text
|
||||
/// </summary>
|
||||
|
||||
@ -2792,6 +2792,12 @@
|
||||
<param name="pdf"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.ResetOCRQueueAsync">
|
||||
<summary>
|
||||
reset ocr queue
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.StartFillingMissingBookTextsAsync">
|
||||
<summary>
|
||||
fill book text
|
||||
@ -18811,6 +18817,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.ResetOCRQueueAsync">
|
||||
<summary>
|
||||
reset OCR Queue (remove queued items)
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.SetPDFPageOCRInfoAsync(RMuseum.Models.PDFLibrary.ViewModels.PDFPageOCRDataViewModel)">
|
||||
<summary>
|
||||
set pdf page ocr info (and if a book whole pages are ocred the book ocred flag is set to true)
|
||||
@ -20091,6 +20103,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.ResetOCRQueueAsync">
|
||||
<summary>
|
||||
reset OCR Queue (remove queued items)
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.SetPDFPageOCRInfoAsync(RMuseum.Models.PDFLibrary.ViewModels.PDFPageOCRDataViewModel)">
|
||||
<summary>
|
||||
set pdf page ocr info (and if a book whole pages are ocred the book ocred flag is set to true)
|
||||
|
||||
@ -400,6 +400,12 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PDFBook>> GetNextUnOCRedPDFBookAsync();
|
||||
|
||||
/// <summary>
|
||||
/// reset OCR Queue (remove queued items)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> ResetOCRQueueAsync();
|
||||
|
||||
/// <summary>
|
||||
/// set pdf page ocr info (and if a book whole pages are ocred the book ocred flag is set to true)
|
||||
/// </summary>
|
||||
|
||||
@ -1731,6 +1731,29 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset OCR Queue (remove queued items)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> ResetOCRQueueAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var ocrQueuedItems = await _context.OCRQueuedItems.ToListAsync();
|
||||
if(ocrQueuedItems.Count > 0)
|
||||
{
|
||||
_context.RemoveRange(ocrQueuedItems);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set pdf page ocr info (and if a book whole pages are ocred the book ocred flag is set to true)
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user