docs: #319 API for retrieving a poem section information

This commit is contained in:
Hamid Reza Mohammadi 2022-05-13 12:03:14 +04:30
parent bcb121fc88
commit 2406ec0e3e
4 changed files with 63 additions and 0 deletions

View File

@ -2795,6 +2795,28 @@ namespace RMuseum.Controllers
return Ok(res.Result);
}
/// <summary>
/// get a specific poem section
/// </summary>
/// <param name="sectionId"></param>
/// <returns></returns>
[HttpGet]
[Route("section/{sectionId}")]
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GanjoorPoemSection>))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
public async Task<IActionResult> GetPoemSectionByIdAsync(int sectionId)
{
var res =
await _ganjoorService.GetPoemSectionByIdAsync(sectionId);
if (!string.IsNullOrEmpty(res.ExceptionString))
return BadRequest(res.ExceptionString);
if (res.Result == null)
return NotFound();
return Ok(res.Result);
}
/// <summary>
/// start band couplets fix
/// </summary>

View File

@ -1707,6 +1707,13 @@
<param name="poemId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetPoemSectionByIdAsync(System.Int32)">
<summary>
get a specific poem section
</summary>
<param name="sectionId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.StartOnTimeBandCoupletsFix">
<summary>
start band couplets fix
@ -12367,6 +12374,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetPoemSectionByIdAsync(System.Int32)">
<summary>
get a specific poem section
</summary>
<param name="sectionId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetLastUnreviewedUserCorrectionForSection(System.Guid,System.Int32)">
<summary>
last unreviewed user correction for a section
@ -14096,6 +14110,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPoemSectionByIdAsync(System.Int32)">
<summary>
get a specific poem sections
</summary>
<param name="sectionId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.StartOnTimeBandCoupletsFix">
<summary>
start band couplets fix

View File

@ -942,6 +942,13 @@ namespace RMuseum.Services
/// <returns></returns>
Task<RServiceResult<GanjoorPoemSection[]>> GetPoemSectionsAsync(int id);
/// <summary>
/// get a specific poem section
/// </summary>
/// <param name="sectionId"></param>
/// <returns></returns>
Task<RServiceResult<GanjoorPoemSection>> GetPoemSectionByIdAsync(int sectionId);
/// <summary>
/// last unreviewed user correction for a section
/// </summary>

View File

@ -642,6 +642,19 @@ namespace RMuseum.Services.Implementation
return new RServiceResult<GanjoorPoemSection[]>(sections);
}
/// <summary>
/// get a specific poem sections
/// </summary>
/// <param name="sectionId"></param>
/// <returns></returns>
public async Task<RServiceResult<GanjoorPoemSection>> GetPoemSectionByIdAsync(int sectionId)
{
return new RServiceResult<GanjoorPoemSection>
(
await _context.GanjoorPoemSections.AsNoTracking().Include(s => s.GanjoorMetre).Where(s => s.Id == sectionId).SingleOrDefaultAsync()
);
}
/// <summary>
/// start band couplets fix
/// </summary>