diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index ded3e007..eb97a1b3 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -4378,6 +4378,32 @@ namespace RMuseum.Controllers return Ok(res.Result); } + /// + /// search tajik poems + /// + /// + /// + /// + /// + /// + [HttpGet] + [Route("tajik/search")] + [AllowAnonymous] + [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))] + [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] + + public async Task SearchTajikAsync([FromQuery] PagingParameterModel paging, string term, int poetId = 0, int catId = 0) + { + var pagedResult = await _ganjoorService.SearchTajikAsync(paging, term, poetId == 0 ? (int?)null : poetId, catId == 0 ? (int?)null : catId); + if (!string.IsNullOrEmpty(pagedResult.ExceptionString)) + return BadRequest(pagedResult.ExceptionString); + + // Paging Header + HttpContext.Response.Headers.Append("paging-headers", JsonConvert.SerializeObject(pagedResult.Result.PagingMeta)); + + return Ok(pagedResult.Result.Items); + } + diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index be2ad7d4..231e82c2 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -2271,6 +2271,16 @@ + + + search tajik poems + + + + + + + readonly mode @@ -16931,6 +16941,16 @@ + + + search tajik poems + + + + + + + translation service implementation diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index 91467978..c3b57169 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -1502,5 +1502,16 @@ namespace RMuseum.Services /// Task> GetTajikPageByUrlAsync(string url, bool catPoems = false); + + /// + /// search tajik poems + /// + /// + /// + /// + /// + /// + Task> SearchTajikAsync(PagingParameterModel paging, string term, int? poetId, int? catId); + } } diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Tajik.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Tajik.cs index 455a5ec2..cd4114b7 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Tajik.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Tajik.cs @@ -195,7 +195,7 @@ namespace RMuseum.Services.Implementation if (string.IsNullOrEmpty(term)) { - return new RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>((null, null), "خطای جستجوی عبارت خالی"); + return new RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>((null, null), "Лутфан иборатиро ворид кунед"); }