* Rename InstallVResponseModel to InstallRequestModel * Align SettingsInstallController * Rename split DatabaseInstallResponseModel in two * Change UserInstallResponseModel to UserInstallViewModel * Use PresentationModel instead of ViewModel * Use operation status pattern when validating database * Prepare for install to return a message * Begin updating steps * Make StepBase sharable between upgrade and install * Update steps * Use error message from install steps in install controller * Use error message from upgrade steps in upgrade controller * Use 500 for install/upgrade failed It's entirely likely that it has nothing to do with the request * Updated OpenApi.Json --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Asp.Versioning;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Umbraco.Cms.Core;
|
|
using Umbraco.Cms.Core.Models.Installer;
|
|
using Umbraco.Cms.Core.Services.Installer;
|
|
using Umbraco.Cms.Core.Services.OperationStatus;
|
|
|
|
namespace Umbraco.Cms.Api.Management.Controllers.Upgrade;
|
|
|
|
[ApiVersion("1.0")]
|
|
public class AuthorizeUpgradeController : UpgradeControllerBase
|
|
{
|
|
private readonly IUpgradeService _upgradeService;
|
|
|
|
public AuthorizeUpgradeController(IUpgradeService upgradeService) => _upgradeService = upgradeService;
|
|
|
|
[HttpPost("authorize")]
|
|
[MapToApiVersion("1.0")]
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status428PreconditionRequired)]
|
|
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
|
|
public async Task<IActionResult> Authorize()
|
|
{
|
|
Attempt<InstallationResult?, UpgradeOperationStatus> result = await _upgradeService.UpgradeAsync();
|
|
return UpgradeOperationResult(result.Status, result.Result);
|
|
}
|
|
}
|