diff --git a/RMuseum/Controllers/RecitationController.cs b/RMuseum/Controllers/RecitationController.cs
index f040c639..20d0b2f2 100644
--- a/RMuseum/Controllers/RecitationController.cs
+++ b/RMuseum/Controllers/RecitationController.cs
@@ -49,6 +49,30 @@ namespace RMuseum.Controllers
return Ok(res.Result.Items);
}
+ ///
+ /// get published recitation by id
+ ///
+ ///
+ ///
+ [HttpGet("published/{id}")]
+ [AllowAnonymous]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(PublicRecitationViewModel))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+ [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
+ public async Task GetPublishedRecitationById(int id)
+ {
+
+
+ var res = await _audioService.GetPublishedRecitationById(id);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+
+ if (res.Result == null)
+ return NotFound();
+
+ return Ok(res.Result);
+ }
+
///
/// creates an RSS file from recent published recitations
///
@@ -136,6 +160,7 @@ namespace RMuseum.Controllers
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+ [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
public async Task GetMp3File(int id)
{
RServiceResult narration =
@@ -174,6 +199,7 @@ namespace RMuseum.Controllers
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+ [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
public async Task GetXMLContent(int id)
{
RServiceResult narration =
@@ -232,6 +258,7 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationViewModel))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
+ [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
public async Task UpdatePoemNarration(int id, [FromBody] RecitationViewModel metadata)
{
@@ -293,6 +320,7 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationViewModel))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
+ [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
public async Task ModeratePoemNarration(int id, [FromBody] RecitationModerateViewModel model)
{
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
@@ -653,7 +681,6 @@ namespace RMuseum.Controllers
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.ReOrderOperationShortName)]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(int))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
- [ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
public async Task MakeFFRecitationsFirst()
{
var resExec = await _audioService.MakeArtistRecitationsFirst("فریدون فرحاندوز");
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index 2a1bfd79..3bc384fd 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -733,6 +733,13 @@
+
+
+ get published recitation by id
+
+
+
+
creates an RSS file from recent published recitations
@@ -5387,12 +5394,19 @@
- returns list of publish narrations
+ returns list of publish recitations
+
+
+ get published recitation by id
+
+
+
+
return selected narration information
@@ -5703,6 +5717,13 @@
+
+
+ get published recitation by id
+
+
+
+
return selected narration information
diff --git a/RMuseum/Services/IRecitationService.cs b/RMuseum/Services/IRecitationService.cs
index 071ef578..0ba29e4c 100644
--- a/RMuseum/Services/IRecitationService.cs
+++ b/RMuseum/Services/IRecitationService.cs
@@ -32,6 +32,13 @@ namespace RMuseum.Services
///
Task> GetPublishedRecitations(PagingParameterModel paging, string searchTerm);
+ ///
+ /// get published recitation by id
+ ///
+ ///
+ ///
+ Task> GetPublishedRecitationById(int id);
+
///
/// return selected narration information
///
diff --git a/RMuseum/Services/Implementation/RecitationService.cs b/RMuseum/Services/Implementation/RecitationService.cs
index 37058978..1925535b 100644
--- a/RMuseum/Services/Implementation/RecitationService.cs
+++ b/RMuseum/Services/Implementation/RecitationService.cs
@@ -71,7 +71,7 @@ namespace RMuseum.Services.Implementationa
}
///
- /// returns list of publish narrations
+ /// returns list of publish recitations
///
///
///
@@ -136,6 +136,51 @@ namespace RMuseum.Services.Implementationa
}
}
+ ///
+ /// get published recitation by id
+ ///
+ ///
+ ///
+ public async Task> GetPublishedRecitationById(int id)
+ {
+ try
+ {
+ var source =
+ from audio in _context.Recitations
+ join poem in _context.GanjoorPoems
+ on audio.GanjoorPostId equals poem.Id
+ where
+ audio.ReviewStatus == AudioReviewStatus.Approved && audio.Id == id
+ select new PublicRecitationViewModel()
+ {
+ Id = audio.Id,
+ PoemId = audio.GanjoorPostId,
+ PoemFullTitle = poem.FullTitle,
+ PoemFullUrl = poem.FullUrl,
+ AudioTitle = audio.AudioTitle,
+ AudioArtist = audio.AudioArtist,
+ AudioArtistUrl = audio.AudioArtistUrl,
+ AudioSrc = audio.AudioSrc,
+ AudioSrcUrl = audio.AudioSrcUrl,
+ LegacyAudioGuid = audio.LegacyAudioGuid,
+ Mp3FileCheckSum = audio.Mp3FileCheckSum,
+ Mp3SizeInBytes = audio.Mp3SizeInBytes,
+ PublishDate = audio.ReviewDate,
+ FileLastUpdated = audio.FileLastUpdated,
+ Mp3Url = $"https://ganjgah.ir/api/audio/file/{audio.Id}.mp3",
+ XmlText = $"https://ganjgah.ir/api/audio/xml/{audio.Id}",
+ PlainText = poem.PlainText,
+ HtmlText = poem.HtmlText
+ };
+
+ return new RServiceResult(await source.SingleOrDefaultAsync());
+ }
+ catch (Exception exp)
+ {
+ return new RServiceResult(null, exp.ToString());
+ }
+ }
+
///
/// return selected narration information
///