//using Microsoft.AspNetCore.Mvc; //using Raven.Client.Documents; //using System.Collections.Generic; //using System.Linq; //using System.Threading.Tasks; //using zero.Core.Api; //using zero.Core.Collections; //using zero.Core.Entities; //using zero.Core.Extensions; //using zero.Core.Routing; //using zero.Web.Models; //namespace zero.Web.Controllers //{ // public class PagesController : BackofficeCollectionController // { // IRoutes Routes; // public PagesController(IPageService collection, IRoutes routes) : base(collection) // { // Routes = routes; // } // public override async Task> GetById([FromQuery] string id, [FromQuery] string changeVector = null) // { // Page entity = changeVector.IsNullOrEmpty() ? await Collection.GetById(id) : await Collection.GetRevision(changeVector); // return entity == null ? null : Edit>(new PageEditModel() // { // Entity = entity, // PageType = Collection.GetPageType(entity.PageTypeAlias), // Urls = new List() { await Routes.GetUrl(entity) } // }); // } // public override async Task> GetPreviews([FromQuery] List ids) // { // IReadOnlyCollection pageTypes = Options.Pages.GetAllItems(); // Dictionary pages = await Collection.GetByIds(ids.ToArray()); // Dictionary routes = await Routes.GetRoutes(pages.Where(x => x.Value != null).Select(x => x.Value).ToArray()); // return Previews(pages, item => // { // routes.TryGetValue(item, out Route route); // PickerPreviewModel model = new() // { // Id = item.Id, // Icon = pageTypes.FirstOrDefault(x => x.Alias == item.PageTypeAlias)?.Icon ?? "fth-folder", // Name = item.Name, // Text = route?.Url.Or("No URL found") // }; // PreviewTransform?.Invoke(item, model); // return model; // }); // } // public async Task> GetChildren([FromQuery] string parent = null, [FromQuery] string active = null, [FromQuery] string search = null) // { // return await Collection.GetChildren(parent, active, search); // } // public PageType GetPageType([FromQuery] string alias) => Collection.GetPageType(alias); // public async Task> GetUrls([FromQuery] string pageId) // { // string url = await Routes.GetUrl(pageId); // return url.HasValue() ? new List() { url } : new List(); // } // public async Task> GetAllowedPageTypes([FromQuery] string parent = null) => await Collection.GetAllowedPageTypes(parent); // public async Task> GetEmptyByType([FromQuery] string type, [FromQuery] string parent = null) => Edit(await Collection.GetEmpty(type, parent)); // [HttpPost] // public async Task>> SaveSorting([FromBody] string[] ids) => await Collection.SaveSorting(ids); // [HttpPost] // public async Task> Move([FromBody] ActionCopyModel model) => await Collection.Move(model.Id, model.DestinationId); // [HttpPost] // public async Task> Copy([FromBody] ActionCopyModel model) => await Collection.Copy(model.Id, model.DestinationId, model.IncludeDescendants); // [HttpPost] // public async Task> Restore([FromBody] ActionCopyModel model) => await Collection.Restore(model.Id, model.IncludeDescendants); // [HttpDelete] // public async Task> DeleteRecursive([FromQuery] string id) => await Collection.Delete(id, recursive: true, moveToRecycleBin: true); // } //}