#255 API method for reporting an error in a recitation
This commit is contained in:
parent
b6dae37f2a
commit
8a70837d0d
@ -800,6 +800,25 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// report an error in a recitation
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("errors/report")]
|
||||
[Authorize]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationErrorReportViewModel))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
|
||||
public async Task<IActionResult> ReportErrorAsync([FromBody] RecitationErrorReportViewModel report)
|
||||
{
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
var res = await _audioService.ReportErrorAsync(loggedOnUserId, report);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
namespace RMuseum.Models.GanjoorAudio.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Post Error Report for recitations
|
||||
/// </summary>
|
||||
public class RecitationErrorReportViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Recitation Id
|
||||
/// </summary>
|
||||
public int RecitationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reason Text
|
||||
/// </summary>
|
||||
public string ReasonText { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1799,6 +1799,13 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.ReportErrorAsync(RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel)">
|
||||
<summary>
|
||||
report an error in a recitation
|
||||
</summary>
|
||||
<param name="report"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.#ctor(RMuseum.Services.IRecitationService,RSecurityBackend.Services.IUserPermissionChecker,RSecurityBackend.Services.IAppUserService)">
|
||||
<summary>
|
||||
constructor
|
||||
@ -3877,6 +3884,26 @@
|
||||
Poem Html Text
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel">
|
||||
<summary>
|
||||
Post Error Report for recitations
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel.Id">
|
||||
<summary>
|
||||
Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel.RecitationId">
|
||||
<summary>
|
||||
Recitation Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel.ReasonText">
|
||||
<summary>
|
||||
Reason Text
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.GanjoorAudio.ViewModels.RecitationModerateViewModel">
|
||||
<summary>
|
||||
Poem Narration Moderation View Model
|
||||
@ -12356,6 +12383,14 @@
|
||||
<param name="filteredUserId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.ReportErrorAsync(System.Guid,RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel)">
|
||||
<summary>
|
||||
report an error in a recitation
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="report"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementationa.RecitationService.UploadEnabled">
|
||||
<summary>
|
||||
Upload Enabled (temporary switch off/on for upload)
|
||||
@ -12699,6 +12734,14 @@
|
||||
<param name="filteredUserId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.ReportErrorAsync(System.Guid,RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel)">
|
||||
<summary>
|
||||
report an error in a recitation
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="report"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.IRecitationService.UploadEnabled">
|
||||
<summary>
|
||||
Upload Enabled (temporary switch off/on for upload)
|
||||
|
||||
@ -201,6 +201,14 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<RecitationViewModel[]>> GetSynchronizationQueue(Guid filteredUserId);
|
||||
|
||||
/// <summary>
|
||||
/// report an error in a recitation
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="report"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<RecitationErrorReportViewModel>> ReportErrorAsync(Guid userId, RecitationErrorReportViewModel report);
|
||||
|
||||
/// <summary>
|
||||
/// Upload Enabled (temporary switch off/on for upload)
|
||||
/// </summary>
|
||||
|
||||
@ -1719,6 +1719,37 @@ namespace RMuseum.Services.Implementationa
|
||||
return new RServiceResult<RecitationViewModel[]>(await source.ToArrayAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// report an error in a recitation
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="report"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<RecitationErrorReportViewModel>> ReportErrorAsync(Guid userId, RecitationErrorReportViewModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
RecitationErrorReport dbModel = new RecitationErrorReport()
|
||||
{
|
||||
RecitationId = report.RecitationId,
|
||||
ReasonText = report.ReasonText,
|
||||
ReporterId = userId,
|
||||
DateTime = DateTime.Now
|
||||
};
|
||||
|
||||
_context.RecitationErrorReports.Add(dbModel);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
report.Id = dbModel.Id;
|
||||
|
||||
return new RServiceResult<RecitationErrorReportViewModel>(report);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<RecitationErrorReportViewModel>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload Enabled (temporary switch off/on for upload)
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user