#411 export tranliterations API
This commit is contained in:
parent
43ae81cd85
commit
e61d555957
@ -1,10 +1,12 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Auth.Memory;
|
||||
using RMuseum.Models.Ganjoor;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Services;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@ -203,6 +205,45 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get all poem translations (for export utility)
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="lang"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet("all/{lang}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + RMuseumSecurableItem.Translations)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorPoemTranslationViewModel[]))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetAllPoemsTranslations([FromQuery] PagingParameterModel paging, int lang)
|
||||
{
|
||||
var res = await _translationService.GetAllPoemsTranslations(paging, lang);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
// Paging Header
|
||||
HttpContext.Response.Headers.Add("paging-headers", JsonConvert.SerializeObject(res.Result.PagingMeta));
|
||||
|
||||
return Ok(res.Result.Translations);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get translation by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + RMuseumSecurableItem.Translations)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorPoemTranslationViewModel))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetPoemTranslationById(int id)
|
||||
{
|
||||
var res = await _translationService.GetPoemTranslationById(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// readonly mode
|
||||
/// </summary>
|
||||
|
||||
@ -3345,6 +3345,21 @@
|
||||
<param name="translation"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.TranslationController.GetAllPoemsTranslations(RSecurityBackend.Models.Generic.PagingParameterModel,System.Int32)">
|
||||
<summary>
|
||||
get all poem translations (for export utility)
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="lang"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.TranslationController.GetPoemTranslationById(System.Int32)">
|
||||
<summary>
|
||||
get translation by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Controllers.TranslationController.ReadOnlyMode">
|
||||
<summary>
|
||||
readonly mode
|
||||
|
||||
Loading…
Reference in New Issue
Block a user