docs: #368 convert a paragraph section verses label mistakenly as poem section to paragraphs and delete the section

This commit is contained in:
Hamid Reza Mohammadi 2023-03-03 21:09:58 +03:30
parent a317dab8e3
commit 62b17b588d
4 changed files with 22 additions and 9 deletions

View File

@ -1100,16 +1100,17 @@ namespace RMuseum.Controllers
/// </summary>
/// <param name="poemId"></param>
/// <param name="sectionIndex"></param>
/// <param name="convertVerses"></param>
/// <returns></returns>
[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<IActionResult> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex)
public async Task<IActionResult> 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)

View File

@ -1219,12 +1219,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32)">
<member name="M:RMuseum.Controllers.GanjoorController.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32,System.Boolean)">
<summary>
delete a poem section (section should not be linked to a poem verse of types other than paragraphs or comments)
</summary>
<param name="poemId"></param>
<param name="sectionIndex"></param>
<param name="convertVerses"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.DeletePoemAsync(System.Int32)">
@ -13135,12 +13136,13 @@
<param name="sectionId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32)">
<member name="M:RMuseum.Services.IGanjoorService.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32,System.Boolean)">
<summary>
delete a poem section
</summary>
<param name="poemId"></param>
<param name="sectionIndex"></param>
<param name="convertVerses"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetLastUnreviewedUserCorrectionForSection(System.Guid,System.Int32)">
@ -15064,12 +15066,13 @@
<param name="sectionId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32)">
<member name="M:RMuseum.Services.Implementation.GanjoorService.DeletePoemSectionByPoemIdAndIndexAsync(System.Int32,System.Int32,System.Boolean)">
<summary>
delete a poem section
</summary>
<param name="poemId"></param>
<param name="sectionIndex"></param>
<param name="convertVerses"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.StartOnTimeBandCoupletsFix">

View File

@ -1011,8 +1011,9 @@ namespace RMuseum.Services
/// </summary>
/// <param name="poemId"></param>
/// <param name="sectionIndex"></param>
/// <param name="convertVerses"></param>
/// <returns></returns>
Task<RServiceResult<bool>> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex);
Task<RServiceResult<bool>> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex, bool convertVerses);
/// <summary>
/// last unreviewed user correction for a section

View File

@ -727,8 +727,9 @@ namespace RMuseum.Services.Implementation
/// </summary>
/// <param name="poemId"></param>
/// <param name="sectionIndex"></param>
/// <param name="convertVerses"></param>
/// <returns></returns>
public async Task<RServiceResult<bool>> DeletePoemSectionByPoemIdAndIndexAsync(int poemId, int sectionIndex)
public async Task<RServiceResult<bool>> 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<bool>(false, "قطعه شامل مصرع‌های غیرپاراگرافی است.");
if (convertVerses)
{
verse.VersePosition = VersePosition.Paragraph;
}
else
{
return new RServiceResult<bool>(false, "قطعه شامل مصرع‌های غیرپاراگرافی است.");
}
}
}
if (verse.SectionIndex1 == sectionIndex)