From 8d25cb67de6321cfd9054455a2e04a0199f866a4 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sat, 22 Jul 2023 17:01:36 +0330 Subject: [PATCH] #399 pdf service methods --- RMuseum/RMuseum.xml | 47 +++++++++++++++++- RMuseum/Services/IPDFLibraryService.cs | 49 ++++++++++++++++++- .../Implementation/PDFLibraryService.cs | 12 ++++- 3 files changed, 104 insertions(+), 4 deletions(-) diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 6c780602..6684162c 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -17407,11 +17407,12 @@ طول تصویر بندانگشتی - + get pdf book by id + @@ -18260,6 +18261,50 @@ PDF Library Services + + + get pdf book by id + + + + + + + + add author + + + + + + + get author by id + + + + + + + get authors + + + + + + + + add book + + + + + + + add multi volume pdf collection + + + + start importing local pdf file diff --git a/RMuseum/Services/IPDFLibraryService.cs b/RMuseum/Services/IPDFLibraryService.cs index 05e70a30..c98bbf36 100644 --- a/RMuseum/Services/IPDFLibraryService.cs +++ b/RMuseum/Services/IPDFLibraryService.cs @@ -1,5 +1,8 @@ -using RMuseum.Models.PDFLibrary.ViewModels; +using RMuseum.Models.Artifact; +using RMuseum.Models.PDFLibrary; +using RMuseum.Models.PDFLibrary.ViewModels; using RSecurityBackend.Models.Generic; +using System.Threading.Tasks; namespace RMuseum.Services { @@ -8,6 +11,50 @@ namespace RMuseum.Services /// public interface IPDFLibraryService { + /// + /// get pdf book by id + /// + /// + /// + /// + Task> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray); + + /// + /// add author + /// + /// + /// + Task> AddAuthorAsync(Author author); + + /// + /// get author by id + /// + /// + /// + Task> GetAuthorByIdAsync(int id); + + /// + /// get authors + /// + /// + /// + /// + Task> GetAuthorsAsync(PagingParameterModel paging, string authorName); + + /// + /// add book + /// + /// + /// + Task> AddBookAsync(Book book); + + /// + /// add multi volume pdf collection + /// + /// + /// + Task> AddMultiVolumePDFCollection(MultiVolumePDFCollection multiVolumePDFCollection); + /// /// start importing local pdf file /// diff --git a/RMuseum/Services/Implementation/PDFLibraryService.cs b/RMuseum/Services/Implementation/PDFLibraryService.cs index b9b4c587..a8852b72 100644 --- a/RMuseum/Services/Implementation/PDFLibraryService.cs +++ b/RMuseum/Services/Implementation/PDFLibraryService.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using RMuseum.DbContext; +using RMuseum.Models.Artifact; using RMuseum.Models.PDFLibrary; using RMuseum.Models.PDFLibrary.ViewModels; using RSecurityBackend.Models.Generic; @@ -22,8 +23,9 @@ namespace RMuseum.Services.Implementation /// get pdf book by id /// /// + /// /// - public async Task> GetPDFBookByIdAsync(int id) + public async Task> GetPDFBookByIdAsync(int id, PublishStatus[] statusArray) { try { @@ -33,7 +35,7 @@ namespace RMuseum.Services.Implementation .Include(b => b.Contributers) .Include(b => b.Tags) .Include(b => b.Pages) - .Where(b => b.Id == id) + .Where(b => statusArray.Contains(b.Status) &&b.Id == id) .SingleOrDefaultAsync(); return new RServiceResult(pdfBook); @@ -169,6 +171,7 @@ namespace RMuseum.Services.Implementation ); return new RServiceResult(true); } + /// /// add author /// @@ -187,6 +190,7 @@ namespace RMuseum.Services.Implementation return new RServiceResult(null, exp.ToString()); } } + /// /// get author by id /// @@ -203,6 +207,7 @@ namespace RMuseum.Services.Implementation return new RServiceResult(null, exp.ToString()); } } + /// /// get authors /// @@ -219,6 +224,7 @@ namespace RMuseum.Services.Implementation await QueryablePaginator.Paginate(source, paging); return new RServiceResult<(PaginationMetadata PagingMeta, Author[] Authors)>(paginatedResult); } + /// /// add book /// @@ -237,6 +243,7 @@ namespace RMuseum.Services.Implementation return new RServiceResult(null, exp.ToString()); } } + /// /// add multi volume pdf collection /// @@ -255,6 +262,7 @@ namespace RMuseum.Services.Implementation return new RServiceResult(null, exp.ToString()); } } + /// /// Database Context ///