parent
ef022120b1
commit
a163082039
@ -2474,6 +2474,7 @@ namespace RMuseum.Controllers
|
||||
/// <param name="term"></param>
|
||||
/// <param name="poetId"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <param name="exceptPoetId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("poems/search")]
|
||||
@ -2481,9 +2482,9 @@ namespace RMuseum.Controllers
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GanjoorPoemCompleteViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
|
||||
public async Task<IActionResult> Search([FromQuery] PagingParameterModel paging, string term, int poetId = 0, int catId = 0)
|
||||
public async Task<IActionResult> Search([FromQuery] PagingParameterModel paging, string term, int poetId = 0, int catId = 0, int[] exceptPoetId = null)
|
||||
{
|
||||
var pagedResult = await _ganjoorService.Search(paging, term, poetId == 0 ? (int?)null : poetId, catId == 0 ? (int?)null : catId);
|
||||
var pagedResult = await _ganjoorService.Search(paging, term, poetId == 0 ? (int?)null : poetId, catId == 0 ? (int?)null : catId, exceptPoetId == null ?[] : exceptPoetId);
|
||||
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
|
||||
return BadRequest(pagedResult.ExceptionString);
|
||||
|
||||
|
||||
@ -1687,7 +1687,7 @@
|
||||
<param name="poetId">0 means all poets</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Int32,System.Int32)">
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Int32,System.Int32,System.Int32[])">
|
||||
<summary>
|
||||
search
|
||||
</summary>
|
||||
@ -1695,6 +1695,7 @@
|
||||
<param name="term"></param>
|
||||
<param name="poetId"></param>
|
||||
<param name="catId"></param>
|
||||
<param name="exceptPoetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetGanjoorMetres(System.Boolean)">
|
||||
@ -16305,7 +16306,7 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32})">
|
||||
<member name="M:RMuseum.Services.IGanjoorService.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Int32[])">
|
||||
<summary>
|
||||
Search
|
||||
</summary>
|
||||
@ -16313,6 +16314,7 @@
|
||||
<param name="term"></param>
|
||||
<param name="poetId"></param>
|
||||
<param name="catId"></param>
|
||||
<param name="exceptPoetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.BatchRenameCatPoemTitles(System.Int32,RMuseum.Models.Ganjoor.ViewModels.GanjoorBatchNamingModel,System.Guid)">
|
||||
@ -20120,7 +20122,7 @@
|
||||
<param name="poetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32})">
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.Search(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Int32[])">
|
||||
<summary>
|
||||
Search
|
||||
You need to run this scripts manually on the database before using this method:
|
||||
@ -20136,6 +20138,7 @@
|
||||
<param name="term"></param>
|
||||
<param name="poetId"></param>
|
||||
<param name="catId"></param>
|
||||
<param name="exceptPoetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.UpdatePageAsync(System.Int32,System.Guid,RMuseum.Models.Ganjoor.ViewModels.GanjoorModifyPageViewModel)">
|
||||
|
||||
@ -687,8 +687,9 @@ namespace RMuseum.Services
|
||||
/// <param name="term"></param>
|
||||
/// <param name="poetId"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <param name="exceptPoetId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> Search(PagingParameterModel paging, string term, int? poetId, int? catId);
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> Search(PagingParameterModel paging, string term, int? poetId, int? catId, int[] exceptPoetId);
|
||||
|
||||
/// <summary>
|
||||
/// batch rename
|
||||
|
||||
@ -2758,8 +2758,9 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="term"></param>
|
||||
/// <param name="poetId"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <param name="exceptPoetId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> Search(PagingParameterModel paging, string term, int? poetId, int? catId)
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> Search(PagingParameterModel paging, string term, int? poetId, int? catId, int[] exceptPoetId)
|
||||
{
|
||||
term = term.Trim().ApplyCorrectYeKe();
|
||||
|
||||
@ -2812,6 +2813,8 @@ namespace RMuseum.Services.Implementation
|
||||
.Where(p =>
|
||||
(catId == null || catIdList.Contains(p.CatId))
|
||||
&&
|
||||
(exceptPoetId.Length == 0 || !exceptPoetId.Contains(p.Cat.PoetId))
|
||||
&&
|
||||
EF.Functions.Contains(p.PlainText, searchConditions)
|
||||
)
|
||||
.Include(p => p.Cat).ThenInclude(c => c.Poet)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user