From 134fccd22a48a7951bba701a34e8d9ae215ff0c3 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sat, 22 Jul 2023 18:00:44 +0330 Subject: [PATCH] #399 StartImportingLocalPDF --- RMuseum/Controllers/PDFLibraryController.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/RMuseum/Controllers/PDFLibraryController.cs b/RMuseum/Controllers/PDFLibraryController.cs index 528d7be2..148d5e1c 100644 --- a/RMuseum/Controllers/PDFLibraryController.cs +++ b/RMuseum/Controllers/PDFLibraryController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using RMuseum.Models.Auth.Memory; using RMuseum.Models.PDFLibrary; +using RMuseum.Models.PDFLibrary.ViewModels; using RMuseum.Services; using RSecurityBackend.Models.Auth.Memory; using System.Net; @@ -13,6 +14,23 @@ namespace RMuseum.Controllers [Route("api/pdf")] public class PDFLibraryController : Controller { + /// + /// start importing a local pdf file + /// + /// + /// + [HttpPost] + [Authorize(Policy = RMuseumSecurableItem.PDFLibraryEntityShortName + ":" + SecurableItem.ModifyOperationShortName)] + [ProducesResponseType((int)HttpStatusCode.OK)] + [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] + public IActionResult StartImportingLocalPDF([FromBody] NewPDFBookViewModel model) + { + var res = _pdfService.StartImportingLocalPDF(model); + if (!string.IsNullOrEmpty(res.ExceptionString)) + return BadRequest(res.ExceptionString); + return Ok(); + } + /// /// add a new book ///