draft: refactor project so it sits on top of a standalone app

This commit is contained in:
2020-05-11 15:34:47 +02:00
parent a9ee5acc1c
commit f97e8455fc
13068 changed files with 1735502 additions and 866 deletions
+6 -12
View File
@@ -1,10 +1,8 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Threading.Tasks;
using zero.Core;
using zero.Core.Api;
using zero.Core.Entities;
using zero.Core.Entities.Setup;
@@ -17,24 +15,20 @@ namespace zero.Web.Setup
[ZeroAuthorize(false)]
public class SetupController : BackofficeController
{
protected ISetupApi Api { get; private set; }
protected IWebHostEnvironment Environment { get; private set; }
protected ZeroOptions Options { get; private set; }
ISetupApi Api;
IWebHostEnvironment Env;
public SetupController(IZeroConfiguration config, ISetupApi api, IWebHostEnvironment env, IOptionsMonitor<ZeroOptions> options) : base(config) // UserManager<User> userManager
public SetupController(ISetupApi api, IWebHostEnvironment env)
{
Api = api;
Environment = env;
Options = options.CurrentValue;
Env = env;
}
public IActionResult Index()
{
if (!Configuration.ZeroVersion.IsNullOrEmpty())
if (!Options.ZeroVersion.IsNullOrEmpty())
{
return Redirect(Options.BackofficePath);
}
@@ -46,7 +40,7 @@ namespace zero.Web.Setup
[HttpPost]
public async Task<IActionResult> Install([FromBody] SetupModel model)
{
model.ContentRootPath = Environment.ContentRootPath;
model.ContentRootPath = Env.ContentRootPath;
EntityResult<SetupModel> result = await Api.Install(model);