Files
mixtape/old/zero.Web/Controllers/TranslationsController.cs
T
2021-11-19 16:11:12 +01:00

25 lines
894 B
C#

using Microsoft.AspNetCore.Mvc;
using Raven.Client.Documents.Linq;
using System.Linq;
using System.Threading.Tasks;
using zero.Core.Collections;
using zero.Core.Database.Indexes;
using zero.Core.Entities;
using zero.Core.Identity;
namespace zero.Web.Controllers
{
[ZeroAuthorize(Permissions.Settings.Translations, PermissionsValue.Read)]
public class TranslationsController : ZeroBackofficeCollectionController<Translation, ITranslationsCollection>
{
public TranslationsController(ITranslationsCollection collection) : base(collection) { }
public override async Task<ListResult<Translation>> GetByQuery([FromQuery] ListBackofficeQuery<Translation> query)
{
query.SearchFor(entity => entity.Key, entity => entity.Value);
query.OrderQuery = q => q.OrderByDescending(x => x.CreatedDate);
return await Collection.Load<zero_Translations>(query);
}
}
}