#415 checking and saving recitation types while uploading

This commit is contained in:
Hamid Reza Mohammadi 2023-12-11 14:52:43 +03:30
parent eb0b04e4ed
commit f97160aa7e
4 changed files with 18 additions and 9 deletions

View File

@ -520,6 +520,7 @@ namespace RMuseum.Controllers
/// if you send true to replace parameter, if there is an existing recitation for the poem from the user with the same Audio Artist name
/// corresponding mp3+xml files are replaced an no other changes is applied (no new post, preserving recitation position)
/// </param>
/// <param name="recitationType"></param>
/// <returns></returns>
[HttpPost]
[Authorize]
@ -527,7 +528,7 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
[ProducesResponseType((int)HttpStatusCode.Unauthorized)]
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
public async Task<IActionResult> UploadReciation(bool replace = false)
public async Task<IActionResult> UploadReciation(bool replace = false, RecitationType recitationType = RecitationType.Normal)
{
try
{
@ -547,7 +548,7 @@ namespace RMuseum.Controllers
}
files.Add(rsFileResult.Result);
}
resSession = await _audioService.FinalizeNewUploadSession(resSession.Result, files.ToArray());
resSession = await _audioService.FinalizeNewUploadSession(resSession.Result, recitationType, files.ToArray());
return Ok(resSession.Result);
}

View File

@ -2510,7 +2510,7 @@
</summary>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.RecitationController.UploadReciation(System.Boolean)">
<member name="M:RMuseum.Controllers.RecitationController.UploadReciation(System.Boolean,RMuseum.Models.GanjoorAudio.RecitationType)">
<summary>
Reciation Upload
</summary>
@ -2518,6 +2518,7 @@
if you send true to replace parameter, if there is an existing recitation for the poem from the user with the same Audio Artist name
corresponding mp3+xml files are replaced an no other changes is applied (no new post, preserving recitation position)
</param>
<param name="recitationType"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.RecitationController.GetUserNarrationProfiles(System.String)">
@ -18744,11 +18745,12 @@
<param name="uploadedFile"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementationa.RecitationService.FinalizeNewUploadSession(RMuseum.Models.UploadSession.UploadSession,RMuseum.Models.UploadSession.UploadSessionFile[])">
<member name="M:RMuseum.Services.Implementationa.RecitationService.FinalizeNewUploadSession(RMuseum.Models.UploadSession.UploadSession,RMuseum.Models.GanjoorAudio.RecitationType,RMuseum.Models.UploadSession.UploadSessionFile[])">
<summary>
finalize upload session (add files)
</summary>
<param name="session"></param>
<param name="recitationType"></param>
<param name="files"></param>
<returns></returns>
</member>
@ -19295,11 +19297,12 @@
<param name="uploadedFile"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IRecitationService.FinalizeNewUploadSession(RMuseum.Models.UploadSession.UploadSession,RMuseum.Models.UploadSession.UploadSessionFile[])">
<member name="M:RMuseum.Services.IRecitationService.FinalizeNewUploadSession(RMuseum.Models.UploadSession.UploadSession,RMuseum.Models.GanjoorAudio.RecitationType,RMuseum.Models.UploadSession.UploadSessionFile[])">
<summary>
finalize upload session (add files)
</summary>
<param name="session"></param>
<param name="recitationType"></param>
<param name="files"></param>
<returns></returns>
</member>

View File

@ -113,9 +113,10 @@ namespace RMuseum.Services
/// finalize upload session (add files)
/// </summary>
/// <param name="session"></param>
/// <param name="recitationType"></param>
/// <param name="files"></param>
/// <returns></returns>
Task<RServiceResult<UploadSession>> FinalizeNewUploadSession(UploadSession session, UploadSessionFile[] files);
Task<RServiceResult<UploadSession>> FinalizeNewUploadSession(UploadSession session, RecitationType recitationType, UploadSessionFile[] files);
/// <summary>
/// Moderate pending narration

View File

@ -834,9 +834,10 @@ namespace RMuseum.Services.Implementationa
/// finalize upload session (add files)
/// </summary>
/// <param name="session"></param>
/// <param name="recitationType"></param>
/// <param name="files"></param>
/// <returns></returns>
public async Task<RServiceResult<UploadSession>> FinalizeNewUploadSession(UploadSession session, UploadSessionFile[] files)
public async Task<RServiceResult<UploadSession>> FinalizeNewUploadSession(UploadSession session, RecitationType recitationType, UploadSessionFile[] files)
{
session.UploadedFiles = files;
session.UploadEndTime = DateTime.Now;
@ -972,7 +973,7 @@ namespace RMuseum.Services.Implementationa
else
{
bool overCrowdedPoem = false;
if (maxRecitationsPerPoem != 0 && maxRecitationsPerPoem <= (await context.Recitations.AsNoTracking().CountAsync(r => r.GanjoorPostId == audio.PoemId && r.ReviewStatus == AudioReviewStatus.Approved)))
if (maxRecitationsPerPoem != 0 && maxRecitationsPerPoem <= (await context.Recitations.AsNoTracking().CountAsync(r => r.GanjoorPostId == audio.PoemId && r.ReviewStatus == AudioReviewStatus.Approved && r.RecitationType == recitationType)))
{
if
(
@ -1094,7 +1095,10 @@ namespace RMuseum.Services.Implementationa
LocalMp3FilePath = localMp3FilePath,
LocalXmlFilePath = localXmlFilePath,
AudioSyncStatus = AudioSyncStatus.NewItem,
ReviewStatus = AudioReviewStatus.Draft
ReviewStatus = AudioReviewStatus.Draft,
InitialScore = 0,
InSyncWithText = true,
RecitationType = recitationType,
};
if (narration.AudioTitle.IndexOf("فایل صوتی") == 0) //no modification on title