#45 upload enabled switch on appsettings.json
This commit is contained in:
parent
ba3cfd2d0d
commit
893a0dfdac
@ -36,7 +36,6 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetPublished([FromQuery] PagingParameterModel paging, string searchTerm = "")
|
||||
{
|
||||
|
||||
if (paging.PageSize == -1 || paging.PageSize > 100)
|
||||
paging.PageSize = 100;
|
||||
var res = await _audioService.GetPublishedRecitations(paging, searchTerm);
|
||||
@ -61,8 +60,6 @@ namespace RMuseum.Controllers
|
||||
[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);
|
||||
@ -111,7 +108,6 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<RecitationViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
|
||||
|
||||
public async Task<IActionResult> Get([FromQuery] PagingParameterModel paging, bool allUsers = false, AudioReviewStatus status = AudioReviewStatus.All, string searchTerm = "")
|
||||
{
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
@ -261,7 +257,8 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
|
||||
public async Task<IActionResult> UpdatePoemNarration(int id, [FromBody] RecitationViewModel metadata)
|
||||
{
|
||||
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("این قابلیت به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
|
||||
@ -323,6 +320,9 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound, Type = typeof(string))]
|
||||
public async Task<IActionResult> ModeratePoemNarration(int id, [FromBody] RecitationModerateViewModel model)
|
||||
{
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("این قابلیت به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
|
||||
|
||||
@ -351,6 +351,9 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden)]
|
||||
public async Task<IActionResult> DeleteRecitation(int id)
|
||||
{
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("این قابلیت به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
RServiceResult<bool> res = await _audioService.Delete(id, loggedOnUserId);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
@ -407,6 +410,20 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result.Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// upload, update, moderate and delete operations on recitations might temporarily become disabled,
|
||||
/// this method gets the current status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet("uploadenabled")]
|
||||
[Authorize]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(bool))]
|
||||
public IActionResult IsUploadEnabled()
|
||||
{
|
||||
return Ok(_audioService.UploadEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reciation Upload
|
||||
/// </summary>
|
||||
@ -425,6 +442,8 @@ namespace RMuseum.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("ارسال خوانش جدید به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
RServiceResult<UploadSession> resSession = await _audioService.InitiateNewUploadSession(loggedOnUserId, replace);
|
||||
if (!string.IsNullOrEmpty(resSession.ExceptionString))
|
||||
@ -482,6 +501,9 @@ namespace RMuseum.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("این قابلیت به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
|
||||
await _audioService.RetryPublish();
|
||||
return Ok();
|
||||
}
|
||||
@ -683,6 +705,9 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> MakeFFRecitationsFirst()
|
||||
{
|
||||
if (!_audioService.UploadEnabled)
|
||||
return BadRequest("این قابلیت به دلیل تغییرات فنی سایت موقتاً غیرفعال است.");
|
||||
|
||||
var resExec = await _audioService.MakeArtistRecitationsFirst("فریدون فرحاندوز");
|
||||
if (!string.IsNullOrEmpty(resExec.ExceptionString))
|
||||
return BadRequest(resExec.ExceptionString);
|
||||
@ -715,8 +740,6 @@ namespace RMuseum.Controllers
|
||||
);
|
||||
if (!string.IsNullOrEmpty(canViewAll.ExceptionString))
|
||||
return BadRequest(canViewAll.ExceptionString);
|
||||
|
||||
|
||||
var res = await _audioService.GetSynchronizationQueue(canViewAll.Result ? Guid.Empty : loggedOnUserId);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
@ -724,6 +747,7 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
|
||||
@ -821,6 +821,13 @@
|
||||
<param name="allUsers">default: false, user must have recitation::moderate permission to be able to see all users uploads</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.IsUploadEnabled">
|
||||
<summary>
|
||||
upload, update, moderate and delete operations on recitations might temporarily become disabled,
|
||||
this method gets the current status
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.UploadReciation(System.Boolean)">
|
||||
<summary>
|
||||
Reciation Upload
|
||||
@ -5585,6 +5592,11 @@
|
||||
<param name="filteredUserId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementationa.RecitationService.UploadEnabled">
|
||||
<summary>
|
||||
Upload Enabled (temporary switch off/on for upload)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementationa.RecitationService.Configuration">
|
||||
<summary>
|
||||
Configuration
|
||||
@ -5889,6 +5901,11 @@
|
||||
<param name="filteredUserId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.IRecitationService.UploadEnabled">
|
||||
<summary>
|
||||
Upload Enabled (temporary switch off/on for upload)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IRNotificationService">
|
||||
<summary>
|
||||
Internal messaging system interface
|
||||
|
||||
@ -203,5 +203,10 @@ namespace RMuseum.Services
|
||||
/// <param name="filteredUserId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<RecitationViewModel[]>> GetSynchronizationQueue(Guid filteredUserId);
|
||||
|
||||
/// <summary>
|
||||
/// Upload Enabled (temporary switch off/on for upload)
|
||||
/// </summary>
|
||||
bool UploadEnabled { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1990,6 +1990,24 @@ namespace RMuseum.Services.Implementationa
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload Enabled (temporary switch off/on for upload)
|
||||
/// </summary>
|
||||
public bool UploadEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return bool.Parse(Configuration.GetSection("AudioUploadService")["Enabled"]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration
|
||||
/// </summary>
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
"RootPath": "/home"
|
||||
},
|
||||
"AudioUploadService": {
|
||||
"Enabled": "True",
|
||||
"TempUploadPath": "C:\\tempaudio",
|
||||
"LocalAudioRepositoryPath": "D:\\My Documents\\My Web Design\\ganjoor\\www\\i",
|
||||
"CurrentSoundFilesFolder": "a2"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user