tree fixes

This commit is contained in:
2020-06-04 15:50:21 +02:00
parent 9a3bc7a080
commit 6fd8d4a144
5 changed files with 237 additions and 171 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ namespace zero.Core.Api
const string NEW_ID = "new:";
IBackofficeStore Backoffice;
protected IBackofficeStore Backoffice { get; private set; }
public BackofficeApi(IBackofficeStore store)
+7 -1
View File
@@ -1,4 +1,5 @@
using Raven.Client.Documents;
using zero.Core.Options;
namespace zero.Core.Api
{
@@ -8,11 +9,14 @@ namespace zero.Core.Api
public IApplicationContext AppContext { get; private set; }
public IZeroOptions Options { get; private set; }
public BackofficeStore(IDocumentStore raven, IApplicationContext appContext)
public BackofficeStore(IDocumentStore raven, IApplicationContext appContext, IZeroOptions options)
{
Raven = raven;
AppContext = appContext;
Options = options;
}
}
@@ -22,5 +26,7 @@ namespace zero.Core.Api
IDocumentStore Raven { get; }
IApplicationContext AppContext { get; }
IZeroOptions Options { get; }
}
}
+2 -7
View File
@@ -14,19 +14,14 @@ namespace zero.Core.Api
{
public class PageTreeApi<T> : AppAwareBackofficeApi, IPageTreeApi<T> where T : IPage
{
protected IZeroOptions Options { get; private set; }
public PageTreeApi(IZeroOptions options, IBackofficeStore store) : base(store)
{
Options = options;
}
public PageTreeApi(IBackofficeStore store) : base(store) { }
/// <inheritdoc />
public async Task<IList<TreeItem>> GetChildren(string parentId = null, string activeId = null)
{
IList<TreeItem> items = new List<TreeItem>();
IReadOnlyCollection<PageType> pageTypes = Options.Pages.GetAllItems();
IReadOnlyCollection<PageType> pageTypes = Backoffice.Options.Pages.GetAllItems();
string[] openIds = new string[0] { };
using (IAsyncDocumentSession session = Raven.OpenAsyncSession())