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);
|
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>
|
/// <summary>
|
||||||
/// creates an RSS file from recent published recitations
|
/// creates an RSS file from recent published recitations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -136,6 +160,7 @@ namespace RMuseum.Controllers
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
|
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
|
||||||
public async Task<IActionResult> GetMp3File(int id)
|
public async Task<IActionResult> GetMp3File(int id)
|
||||||
{
|
{
|
||||||
RServiceResult<RecitationViewModel> narration =
|
RServiceResult<RecitationViewModel> narration =
|
||||||
@ -174,6 +199,7 @@ namespace RMuseum.Controllers
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(string))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
|
||||||
public async Task<IActionResult> GetXMLContent(int id)
|
public async Task<IActionResult> GetXMLContent(int id)
|
||||||
{
|
{
|
||||||
RServiceResult<RecitationViewModel> narration =
|
RServiceResult<RecitationViewModel> narration =
|
||||||
@ -232,6 +258,7 @@ namespace RMuseum.Controllers
|
|||||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationViewModel))]
|
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationViewModel))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.Forbidden, 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)
|
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.OK, Type = typeof(RecitationViewModel))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.Forbidden, 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)
|
public async Task<IActionResult> ModeratePoemNarration(int id, [FromBody] RecitationModerateViewModel model)
|
||||||
{
|
{
|
||||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
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)]
|
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.ReOrderOperationShortName)]
|
||||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(int))]
|
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(int))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||||
[ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
|
|
||||||
public async Task<IActionResult> MakeFFRecitationsFirst()
|
public async Task<IActionResult> MakeFFRecitationsFirst()
|
||||||
{
|
{
|
||||||
var resExec = await _audioService.MakeArtistRecitationsFirst("فریدون فرحاندوز");
|
var resExec = await _audioService.MakeArtistRecitationsFirst("فریدون فرحاندوز");
|
||||||
|
|||||||
@ -733,6 +733,13 @@
|
|||||||
<param name="searchTerm"></param>
|
<param name="searchTerm"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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">
|
<member name="M:RMuseum.Controllers.RecitationController.GetRssFeed">
|
||||||
<summary>
|
<summary>
|
||||||
creates an RSS file from recent published recitations
|
creates an RSS file from recent published recitations
|
||||||
@ -5387,12 +5394,19 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.GetPublishedRecitations(RSecurityBackend.Models.Generic.PagingParameterModel,System.String)">
|
<member name="M:RMuseum.Services.Implementationa.RecitationService.GetPublishedRecitations(RSecurityBackend.Models.Generic.PagingParameterModel,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
returns list of publish narrations
|
returns list of publish recitations
|
||||||
</summary>
|
</summary>
|
||||||
<param name="paging"></param>
|
<param name="paging"></param>
|
||||||
<param name="searchTerm"></param>
|
<param name="searchTerm"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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)">
|
<member name="M:RMuseum.Services.Implementationa.RecitationService.Get(System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
return selected narration information
|
return selected narration information
|
||||||
@ -5703,6 +5717,13 @@
|
|||||||
<param name="searchTerm"></param>
|
<param name="searchTerm"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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)">
|
<member name="M:RMuseum.Services.IRecitationService.Get(System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
return selected narration information
|
return selected narration information
|
||||||
|
|||||||
@ -32,6 +32,13 @@ namespace RMuseum.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<RServiceResult<(PaginationMetadata PagingMeta, PublicRecitationViewModel[] Items)>> GetPublishedRecitations(PagingParameterModel paging, string searchTerm);
|
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>
|
/// <summary>
|
||||||
/// return selected narration information
|
/// return selected narration information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace RMuseum.Services.Implementationa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// returns list of publish narrations
|
/// returns list of publish recitations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="paging"></param>
|
/// <param name="paging"></param>
|
||||||
/// <param name="searchTerm"></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>
|
/// <summary>
|
||||||
/// return selected narration information
|
/// return selected narration information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user