published/id api added
This commit is contained in:
parent
a3f1fcef58
commit
be626256e8
@ -49,6 +49,30 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result.Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get published recitation by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[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<IActionResult> 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// creates an RSS file from recent published recitations
|
||||
/// </summary>
|
||||
@ -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<IActionResult> GetMp3File(int id)
|
||||
{
|
||||
RServiceResult<RecitationViewModel> 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<IActionResult> GetXMLContent(int id)
|
||||
{
|
||||
RServiceResult<RecitationViewModel> 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<IActionResult> 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<IActionResult> 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<IActionResult> MakeFFRecitationsFirst()
|
||||
{
|
||||
var resExec = await _audioService.MakeArtistRecitationsFirst("فریدون فرحاندوز");
|
||||
|
||||
@ -733,6 +733,13 @@
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.GetPublishedRecitationById(System.Int32)">
|
||||
<summary>
|
||||
get published recitation by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.GetRssFeed">
|
||||
<summary>
|
||||
creates an RSS file from recent published recitations
|
||||
@ -5387,12 +5394,19 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.GetPublishedRecitations(RSecurityBackend.Models.Generic.PagingParameterModel,System.String)">
|
||||
<summary>
|
||||
returns list of publish narrations
|
||||
returns list of publish recitations
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.GetPublishedRecitationById(System.Int32)">
|
||||
<summary>
|
||||
get published recitation by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.Get(System.Int32)">
|
||||
<summary>
|
||||
return selected narration information
|
||||
@ -5703,6 +5717,13 @@
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.GetPublishedRecitationById(System.Int32)">
|
||||
<summary>
|
||||
get published recitation by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.Get(System.Int32)">
|
||||
<summary>
|
||||
return selected narration information
|
||||
|
||||
@ -32,6 +32,13 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, PublicRecitationViewModel[] Items)>> GetPublishedRecitations(PagingParameterModel paging, string searchTerm);
|
||||
|
||||
/// <summary>
|
||||
/// get published recitation by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PublicRecitationViewModel>> GetPublishedRecitationById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// return selected narration information
|
||||
/// </summary>
|
||||
|
||||
@ -71,7 +71,7 @@ namespace RMuseum.Services.Implementationa
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns list of publish narrations
|
||||
/// returns list of publish recitations
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="searchTerm"></param>
|
||||
@ -136,6 +136,51 @@ namespace RMuseum.Services.Implementationa
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get published recitation by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<PublicRecitationViewModel>> 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<PublicRecitationViewModel>(await source.SingleOrDefaultAsync());
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<PublicRecitationViewModel>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return selected narration information
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user