#38 search recitations
This commit is contained in:
parent
4ffa95fa52
commit
41ff4fc131
@ -30,6 +30,7 @@ namespace RMuseum.Controllers
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="allUsers">default: false, user must have narration::moderate permission to be able to see all users narrations</param>
|
||||
/// <param name="status">default: -1, unfiltered</param>
|
||||
/// <param name="searchTerm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
@ -37,7 +38,7 @@ namespace RMuseum.Controllers
|
||||
[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 )
|
||||
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);
|
||||
Guid sessionId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "SessionId").Value);
|
||||
@ -60,7 +61,7 @@ namespace RMuseum.Controllers
|
||||
return StatusCode((int)HttpStatusCode.Forbidden);
|
||||
}
|
||||
|
||||
var res = await _audioService.GetAll(paging, allUsers ? Guid.Empty : loggedOnUserId, status);
|
||||
var res = await _audioService.GetAll(paging, allUsers ? Guid.Empty : loggedOnUserId, status, searchTerm);
|
||||
if(!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
|
||||
|
||||
@ -694,13 +694,14 @@
|
||||
Artifact Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.Get(RSecurityBackend.Models.Generic.PagingParameterModel,System.Boolean,RMuseum.Models.GanjoorAudio.AudioReviewStatus)">
|
||||
<member name="M:RMuseum.Controllers.RecitationController.Get(RSecurityBackend.Models.Generic.PagingParameterModel,System.Boolean,RMuseum.Models.GanjoorAudio.AudioReviewStatus,System.String)">
|
||||
<summary>
|
||||
Gets audio narrations, user must have narration::moderate permission to be able to see all users narrations
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="allUsers">default: false, user must have narration::moderate permission to be able to see all users narrations</param>
|
||||
<param name="status">default: -1, unfiltered</param>
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.GetMp3File(System.Int32)">
|
||||
@ -4989,13 +4990,14 @@
|
||||
Audio Narration Service Implementation
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.RecitationService.GetAll(RSecurityBackend.Models.Generic.PagingParameterModel,System.Guid,RMuseum.Models.GanjoorAudio.AudioReviewStatus)">
|
||||
<member name="M:RMuseum.Services.Implementation.RecitationService.GetAll(RSecurityBackend.Models.Generic.PagingParameterModel,System.Guid,RMuseum.Models.GanjoorAudio.AudioReviewStatus,System.String)">
|
||||
<summary>
|
||||
returns list of narrations
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="filteredUserId">send Guid.Empty if you want all narrations</param>
|
||||
<param name="status"></param>
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.RecitationService.Get(System.Int32)">
|
||||
@ -5339,13 +5341,14 @@
|
||||
Audio Narration Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.GetAll(RSecurityBackend.Models.Generic.PagingParameterModel,System.Guid,RMuseum.Models.GanjoorAudio.AudioReviewStatus)">
|
||||
<member name="M:RMuseum.Services.IRecitationService.GetAll(RSecurityBackend.Models.Generic.PagingParameterModel,System.Guid,RMuseum.Models.GanjoorAudio.AudioReviewStatus,System.String)">
|
||||
<summary>
|
||||
returns list of narrations
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="filteredUserId">send Guid.Empty if you want all narrations</param>
|
||||
<param name="status"></param>
|
||||
<param name="searchTerm"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.Get(System.Int32)">
|
||||
|
||||
@ -20,8 +20,9 @@ namespace RMuseum.Services
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="filteredUserId">send Guid.Empty if you want all narrations</param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="searchTerm"></param>
|
||||
/// <returns></returns>
|
||||
public Task<RServiceResult<(PaginationMetadata PagingMeta, RecitationViewModel[] Items)>> GetAll(PagingParameterModel paging, Guid filteredUserId, AudioReviewStatus status);
|
||||
public Task<RServiceResult<(PaginationMetadata PagingMeta, RecitationViewModel[] Items)>> GetAll(PagingParameterModel paging, Guid filteredUserId, AudioReviewStatus status, string searchTerm);
|
||||
|
||||
/// <summary>
|
||||
/// return selected narration information
|
||||
|
||||
@ -30,18 +30,15 @@ namespace RMuseum.Services.Implementation
|
||||
/// </summary>
|
||||
public class RecitationService : IRecitationService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns list of narrations
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="filteredUserId">send Guid.Empty if you want all narrations</param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="searchTerm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, RecitationViewModel[] Items)>> GetAll(PagingParameterModel paging, Guid filteredUserId, AudioReviewStatus status)
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, RecitationViewModel[] Items)>> GetAll(PagingParameterModel paging, Guid filteredUserId, AudioReviewStatus status, string searchTerm)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -53,6 +50,8 @@ namespace RMuseum.Services.Implementation
|
||||
(filteredUserId == Guid.Empty || a.OwnerId == filteredUserId)
|
||||
&&
|
||||
(status == AudioReviewStatus.All || a.ReviewStatus == status)
|
||||
&&
|
||||
(string.IsNullOrEmpty(searchTerm) || (!string.IsNullOrEmpty(searchTerm) && (a.AudioArtist.Contains(searchTerm) || a.AudioTitle.Contains(searchTerm) )))
|
||||
)
|
||||
.OrderByDescending(a => a.UploadDate)
|
||||
join poem in _context.GanjoorPoems
|
||||
|
||||
Loading…
Reference in New Issue
Block a user