2020-05-04 14:13:03 +02:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2020-11-19 14:57:00 +01:00
|
|
|
using Raven.Client.Documents.Linq;
|
|
|
|
|
using System.Linq;
|
2020-05-04 14:13:03 +02:00
|
|
|
using System.Threading.Tasks;
|
2020-11-19 14:57:00 +01:00
|
|
|
using zero.Core.Collections;
|
2021-10-15 13:04:05 +02:00
|
|
|
using zero.Core.Database.Indexes;
|
2020-05-04 14:13:03 +02:00
|
|
|
using zero.Core.Entities;
|
|
|
|
|
using zero.Core.Identity;
|
|
|
|
|
|
|
|
|
|
namespace zero.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
[ZeroAuthorize(Permissions.Settings.Translations, PermissionsValue.Read)]
|
2021-05-04 17:23:52 +02:00
|
|
|
public class TranslationsController : BackofficeCollectionController<Translation, ITranslationsCollection>
|
2020-05-04 14:13:03 +02:00
|
|
|
{
|
2021-10-15 13:04:05 +02:00
|
|
|
public TranslationsController(ITranslationsCollection collection) : base(collection) { }
|
2020-05-04 14:13:03 +02:00
|
|
|
|
2021-05-04 17:23:52 +02:00
|
|
|
public override async Task<ListResult<Translation>> GetByQuery([FromQuery] ListBackofficeQuery<Translation> query)
|
2020-11-19 14:57:00 +01:00
|
|
|
{
|
|
|
|
|
query.SearchFor(entity => entity.Key, entity => entity.Value);
|
2021-10-15 13:04:05 +02:00
|
|
|
query.OrderQuery = q => q.OrderByDescending(x => x.CreatedDate);
|
|
|
|
|
return await Collection.GetByQuery<zero_Translations>(query);
|
2020-11-19 14:57:00 +01:00
|
|
|
}
|
2020-05-04 14:13:03 +02:00
|
|
|
}
|
|
|
|
|
}
|