#407 adding BookText field
This commit is contained in:
parent
a58fb2b3e1
commit
dc0ee360da
@ -118,13 +118,14 @@ namespace RMuseum.Controllers
|
||||
/// secure get a pdf book
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="omitBookText"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("secure/{id}")]
|
||||
[Authorize]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(PDFBook))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> GetUserVisiblePDFBookAsync(int id)
|
||||
public async Task<IActionResult> GetUserVisiblePDFBookAsync(int id, bool omitBookText = true)
|
||||
{
|
||||
RServiceResult<PublishStatus[]> v = await _GetUserVisiblePDFBooksStatusSetAsync
|
||||
(
|
||||
@ -137,7 +138,7 @@ namespace RMuseum.Controllers
|
||||
RServiceResult<PDFBook> bookRes = null;
|
||||
if (visibleItems.Length == 1 && visibleItems[0] == PublishStatus.Published)
|
||||
{
|
||||
bookRes = await _pdfService.GetPDFBookByIdAsync(id, new PublishStatus[] { PublishStatus.Published });
|
||||
bookRes = await _pdfService.GetPDFBookByIdAsync(id, new PublishStatus[] { PublishStatus.Published }, omitBookText);
|
||||
if (!string.IsNullOrEmpty(bookRes.ExceptionString))
|
||||
{
|
||||
return BadRequest(bookRes.ExceptionString);
|
||||
@ -147,7 +148,7 @@ namespace RMuseum.Controllers
|
||||
}
|
||||
if (bookRes == null)
|
||||
{
|
||||
bookRes = await _pdfService.GetPDFBookByIdAsync(id, visibleItems);
|
||||
bookRes = await _pdfService.GetPDFBookByIdAsync(id, visibleItems, omitBookText);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(bookRes.ExceptionString))
|
||||
@ -207,15 +208,16 @@ namespace RMuseum.Controllers
|
||||
/// get published PDF Book by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="omitBookText"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(PDFBook))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> GetPDFBookByIdAsync(int id)
|
||||
public async Task<IActionResult> GetPDFBookByIdAsync(int id, bool omitBookText = true)
|
||||
{
|
||||
var bookRes = await _pdfService.GetPDFBookByIdAsync(id, new PublishStatus[] { PublishStatus.Published });
|
||||
var bookRes = await _pdfService.GetPDFBookByIdAsync(id, new PublishStatus[] { PublishStatus.Published }, omitBookText);
|
||||
|
||||
if (!string.IsNullOrEmpty(bookRes.ExceptionString))
|
||||
{
|
||||
|
||||
@ -244,5 +244,10 @@ namespace RMuseum.Models.PDFLibrary
|
||||
/// ocr date time
|
||||
/// </summary>
|
||||
public DateTime OCRTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// book text
|
||||
/// </summary>
|
||||
public string BookText { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2394,18 +2394,20 @@
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetUserVisiblePDFBookAsync(System.Int32)">
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetUserVisiblePDFBookAsync(System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
secure get a pdf book
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="omitBookText"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetPDFBookByIdAsync(System.Int32)">
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.GetPDFBookByIdAsync(System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
get published PDF Book by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="omitBookText"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.PDFLibraryController.StartImportingLocalPDFAsync(RMuseum.Models.PDFLibrary.ViewModels.NewPDFBookViewModel)">
|
||||
@ -12779,6 +12781,11 @@
|
||||
ocr date time
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.PDFLibrary.PDFBook.BookText">
|
||||
<summary>
|
||||
book text
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.PDFLibrary.PDFPage">
|
||||
<summary>
|
||||
PDF Page
|
||||
@ -18405,12 +18412,13 @@
|
||||
<param name="srcUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.GetPDFBookByIdAsync(System.Int32,RMuseum.Models.Artifact.PublishStatus[])">
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.GetPDFBookByIdAsync(System.Int32,RMuseum.Models.Artifact.PublishStatus[],System.Boolean)">
|
||||
<summary>
|
||||
get pdf book by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="statusArray"></param>
|
||||
<param name="omitBookText"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.GetAllPDFBooksAsync(RSecurityBackend.Models.Generic.PagingParameterModel,RMuseum.Models.Artifact.PublishStatus[])">
|
||||
@ -19656,12 +19664,13 @@
|
||||
<param name="srcUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.GetPDFBookByIdAsync(System.Int32,RMuseum.Models.Artifact.PublishStatus[])">
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.GetPDFBookByIdAsync(System.Int32,RMuseum.Models.Artifact.PublishStatus[],System.Boolean)">
|
||||
<summary>
|
||||
get pdf book by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="statusArray"></param>
|
||||
<param name="omitBookText"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.GetAllPDFBooksAsync(RSecurityBackend.Models.Generic.PagingParameterModel,RMuseum.Models.Artifact.PublishStatus[])">
|
||||
|
||||
@ -25,8 +25,9 @@ namespace RMuseum.Services
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="statusArray"></param>
|
||||
/// <param name="omitBookText"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PDFBook>> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray);
|
||||
Task<RServiceResult<PDFBook>> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray, bool omitBookText);
|
||||
|
||||
/// <summary>
|
||||
/// get all pdfbooks (including CoverImage info but not pages or tagibutes info)
|
||||
|
||||
@ -45,8 +45,9 @@ namespace RMuseum.Services.Implementation
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="statusArray"></param>
|
||||
/// <param name="omitBookText"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<PDFBook>> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray)
|
||||
public async Task<RServiceResult<PDFBook>> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray, bool omitBookText)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -62,6 +63,10 @@ namespace RMuseum.Services.Implementation
|
||||
.SingleOrDefaultAsync();
|
||||
if (pdfBook != null)
|
||||
{
|
||||
if(omitBookText)
|
||||
{
|
||||
pdfBook.BookText = "";
|
||||
}
|
||||
if (pdfBook.Book != null)
|
||||
{
|
||||
pdfBook.Book.PDFBooks = await _context.PDFBooks.AsNoTracking()
|
||||
@ -139,6 +144,10 @@ namespace RMuseum.Services.Implementation
|
||||
.AsQueryable();
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Books) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
foreach (var book in paginatedResult.Books)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Books)>(paginatedResult);
|
||||
}
|
||||
catch (Exception exp)
|
||||
@ -350,7 +359,10 @@ namespace RMuseum.Services.Implementation
|
||||
.ToArrayAsync();
|
||||
|
||||
foreach (PDFBook taggedItem in taggedItems)
|
||||
{
|
||||
taggedItem.Tags = null;
|
||||
taggedItem.BookText = "";
|
||||
}
|
||||
|
||||
return new RServiceResult<PDFBook[]>(taggedItems);
|
||||
}
|
||||
@ -700,6 +712,10 @@ namespace RMuseum.Services.Implementation
|
||||
.AsQueryable();
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Books) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
foreach (var book in paginatedResult.Books)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Books)>(paginatedResult);
|
||||
}
|
||||
catch (Exception exp)
|
||||
@ -1038,6 +1054,10 @@ namespace RMuseum.Services.Implementation
|
||||
.AsQueryable();
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Books) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
foreach (var book in paginatedResult.Books)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Books)>(paginatedResult);
|
||||
}
|
||||
catch (Exception exp)
|
||||
@ -1147,10 +1167,14 @@ namespace RMuseum.Services.Implementation
|
||||
{
|
||||
var books =
|
||||
await _context.PDFBooks.AsNoTracking()
|
||||
.Include(a => a.CoverImage)
|
||||
.Where(a => a.Status == PublishStatus.Published && a.MultiVolumePDFCollectionId == volumeId)
|
||||
.OrderBy(t => t.VolumeOrder)
|
||||
.ToArrayAsync();
|
||||
.Include(a => a.CoverImage)
|
||||
.Where(a => a.Status == PublishStatus.Published && a.MultiVolumePDFCollectionId == volumeId)
|
||||
.OrderBy(t => t.VolumeOrder)
|
||||
.ToArrayAsync();
|
||||
foreach (var book in books)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
return new RServiceResult<PDFBook[]>(books);
|
||||
}
|
||||
catch (Exception exp)
|
||||
@ -1266,12 +1290,16 @@ namespace RMuseum.Services.Implementation
|
||||
{
|
||||
var source =
|
||||
_context.PDFBooks.AsNoTracking()
|
||||
.Include(a => a.CoverImage)
|
||||
.Where(a => a.Status == PublishStatus.Published && a.PDFSourceId == sourceId)
|
||||
.OrderByDescending(t => t.Title)
|
||||
.AsQueryable();
|
||||
.Include(a => a.CoverImage)
|
||||
.Where(a => a.Status == PublishStatus.Published && a.PDFSourceId == sourceId)
|
||||
.OrderByDescending(t => t.Title)
|
||||
.AsQueryable();
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Books) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
foreach (var book in paginatedResult.Books)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Books)>(paginatedResult);
|
||||
}
|
||||
catch (Exception exp)
|
||||
@ -1340,6 +1368,11 @@ namespace RMuseum.Services.Implementation
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Items) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
|
||||
foreach (var book in paginatedResult.Items)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
|
||||
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Items)>(paginatedResult);
|
||||
}
|
||||
@ -1699,6 +1732,11 @@ namespace RMuseum.Services.Implementation
|
||||
(PaginationMetadata PagingMeta, PDFBook[] Items) paginatedResult =
|
||||
await QueryablePaginator<PDFBook>.Paginate(source, paging);
|
||||
|
||||
foreach (var book in paginatedResult.Items)
|
||||
{
|
||||
book.BookText = "";
|
||||
}
|
||||
|
||||
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFBook[] Items)>(paginatedResult);
|
||||
}
|
||||
@ -1762,6 +1800,7 @@ namespace RMuseum.Services.Implementation
|
||||
foreach (PDFPage page in paginatedResult.Items)
|
||||
{
|
||||
page.PDFBook = await _context.PDFBooks.AsNoTracking().Where(b => b.Id == page.PDFBookId).SingleAsync();
|
||||
page.PDFBook.BookText = "";
|
||||
}
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PDFPage[] Items)>(paginatedResult);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user