Files
mixtape/zero.Web/Controllers/TranslationsController.cs
T

25 lines
896 B
C#
Raw Normal View History

2020-05-04 14:13:03 +02:00
using Microsoft.AspNetCore.Mvc;
using Raven.Client.Documents.Linq;
using System.Linq;
2020-05-04 14:13:03 +02:00
using System.Threading.Tasks;
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)
{
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-05-04 14:13:03 +02:00
}
}