diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index cd4dd727..16caa7a2 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -1100,16 +1100,17 @@ namespace RMuseum.Controllers /// /// /// + /// /// [HttpDelete] - [Route("section/{poemId}/{sectionIndex}")] + [Route("section/{poemId}/{sectionIndex}/{convertVerses}")] [Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + SecurableItem.ModifyOperationShortName)] [ProducesResponseType((int)HttpStatusCode.OK)] [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] [ProducesResponseType((int)HttpStatusCode.NotFound)] - public async Task DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex) + public async Task DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex, bool convertVerses) { - var res = await _ganjoorService.DeletePoemSectionByPoemIdAndIndexAsync(poemId, sectionIndex); + var res = await _ganjoorService.DeletePoemSectionByPoemIdAndIndexAsync(poemId, sectionIndex, convertVerses); if (!string.IsNullOrEmpty(res.ExceptionString)) return BadRequest(res.ExceptionString); if(res.Result == false) diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 57af6e17..e69ea33e 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -1219,12 +1219,13 @@ - + delete a poem section (section should not be linked to a poem verse of types other than paragraphs or comments) + @@ -13135,12 +13136,13 @@ - + delete a poem section + @@ -15064,12 +15066,13 @@ - + delete a poem section + diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index dd29d1c0..3d28ff9b 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -1011,8 +1011,9 @@ namespace RMuseum.Services /// /// /// + /// /// - Task> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex); + Task> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex, bool convertVerses); /// /// last unreviewed user correction for a section diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs index 7111467c..0f21a91f 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs @@ -727,8 +727,9 @@ namespace RMuseum.Services.Implementation /// /// /// + /// /// - public async Task> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex) + public async Task> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex, bool convertVerses) { try { @@ -751,7 +752,14 @@ namespace RMuseum.Services.Implementation { if (verse.VersePosition != VersePosition.Paragraph && verse.VersePosition != VersePosition.Comment) { - return new RServiceResult(false, "قطعه شامل مصرع‌های غیرپاراگرافی است."); + if (convertVerses) + { + verse.VersePosition = VersePosition.Paragraph; + } + else + { + return new RServiceResult(false, "قطعه شامل مصرع‌های غیرپاراگرافی است."); + } } } if (verse.SectionIndex1 == sectionIndex)