Compare commits
110
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
011634e9ba | ||
|
|
1afac0c247 | ||
|
|
797db55f73 | ||
|
|
2031298001 | ||
|
|
8604163c91 | ||
|
|
3939742917 | ||
|
|
684790df70 | ||
|
|
16ee7227ae | ||
|
|
9e9c8c986c | ||
|
|
3210c304fe | ||
|
|
63f2fabb5f | ||
|
|
21283245f1 | ||
|
|
b02b201cab | ||
|
|
0c2485adf9 | ||
|
|
1bb2837254 | ||
|
|
0281d800d0 | ||
|
|
ecbfc72323 | ||
|
|
ff58fbd2b1 | ||
|
|
4778501a6e | ||
|
|
10e56a52f3 | ||
|
+8 |
3bd66b89e1 | ||
|
|
10a70a8397 | ||
|
|
af07c42120 | ||
|
|
64e8f34f0f | ||
|
|
6aa471479e | ||
|
|
8178dba674 | ||
|
|
385a8fecba | ||
|
|
84d8736b90 | ||
|
|
fd1761dcc1 | ||
|
|
6630220961 | ||
|
|
e1f9219b93 | ||
|
|
6a36a797ad | ||
|
|
dc87cf800f | ||
|
|
e0341f9d10 | ||
|
|
8754caa06f | ||
|
|
7d7db6bb2b | ||
|
|
c3709de1d3 | ||
|
|
7e46a1c148 | ||
|
|
dbd9218c75 | ||
|
|
d1ee95c7b1 | ||
|
|
7b4bfbb28e | ||
|
|
00ec63a966 | ||
|
|
19123b4799 | ||
|
|
3446b77d7d | ||
|
|
1e5d29e667 | ||
|
|
fdef134c3b | ||
|
|
bcaaf5a1f4 | ||
|
|
d438d79b8c | ||
|
|
0c7202c6d9 | ||
|
|
361c9d9f97 | ||
|
|
678bce697b | ||
|
|
b008afbb27 | ||
|
|
11479b22b3 | ||
|
|
1c6b7698c8 | ||
|
|
8c5fe3d52b | ||
|
|
04b44af3f9 | ||
|
|
74b1f42909 | ||
|
|
26d66a815a | ||
|
|
d93b0002ba | ||
|
|
064c85f47a | ||
|
|
12f4c17f85 | ||
|
|
fd4585fba7 | ||
|
|
7dc9cbd9b1 | ||
|
|
f5c307b8f1 | ||
|
|
0b0a2dc251 | ||
|
|
780f16e79b | ||
|
|
fdea721a8e | ||
|
|
2fe83b5637 | ||
|
|
9ee31367df | ||
|
|
825f791d01 | ||
|
|
fb3a56a240 | ||
|
|
0d1afcf3c7 | ||
|
|
a82e0ca23a | ||
|
|
663be397dc | ||
|
|
83aca5aa6e | ||
|
|
991b8bfb37 | ||
|
|
6c9ff96972 | ||
|
|
0d4acb440d | ||
|
|
3f5898ba95 | ||
|
|
939552e9f1 | ||
|
|
0a7d0a8f8b | ||
|
|
b9eb988d29 | ||
|
|
9beb679dbf | ||
|
|
9b3da86192 | ||
|
|
1d5a4dfa3a | ||
|
|
9d7c2d4a82 | ||
|
|
5ccbf08365 | ||
|
|
0e561da146 | ||
|
|
85b3df6672 | ||
|
|
d8b5006b30 | ||
|
|
c8eb4f1d53 | ||
|
|
98bf623721 | ||
|
|
13c788d6ec | ||
|
|
780184e553 | ||
|
|
561d871677 | ||
|
|
064a71240e | ||
|
|
678e942a2e | ||
|
|
a76344ec4c | ||
|
|
e77bac3088 | ||
|
|
27afb3f0f3 | ||
|
|
822a8cc2f1 | ||
|
|
32792b4ba4 | ||
|
|
849b98cbaf | ||
|
|
0b3836456e | ||
|
|
0d1cdd1bb4 | ||
|
|
1504b5c0d3 | ||
|
|
d482d9161c | ||
|
|
57d6bd75e3 | ||
|
|
e5168dee4a | ||
|
|
254e81823f |
@@ -0,0 +1,55 @@
|
||||
name: Backoffice Static Web Apps CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- contrib
|
||||
- v*/dev
|
||||
paths:
|
||||
- src/Umbraco.Web.UI.Client/package.json
|
||||
- src/Umbraco.Web.UI.Client/package-lock.json
|
||||
- src/Umbraco.Web.UI.Client/src/**
|
||||
- .github/workflows/azure-backoffice.yml
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- contrib
|
||||
- v*/dev
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed' && (contains(github.event.pull_request.labels.*.name, 'preview/backoffice')))
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy Job
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build And Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
production_branch: contrib
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_GROUND_017B08103 }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
|
||||
action: "upload"
|
||||
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
|
||||
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
|
||||
app_location: "src/Umbraco.Web.UI.Client" # App source code path
|
||||
app_build_command: "npm run build:for:static"
|
||||
output_location: "dist" # Built app content directory - optional
|
||||
skip_api_build: true # Set to true if you do not have an Azure Functions API in your repo
|
||||
###### End of Repository/Build Configurations ######
|
||||
|
||||
close_pull_request_job:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Close Pull Request Job
|
||||
steps:
|
||||
- name: Close Pull Request
|
||||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
app_location: "src/Umbraco.Web.UI.Client"
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_GROUND_017B08103 }}
|
||||
action: "close"
|
||||
@@ -0,0 +1,56 @@
|
||||
name: Storybook CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- contrib
|
||||
- v*/dev
|
||||
paths:
|
||||
- src/Umbraco.Web.UI.Client/package.json
|
||||
- src/Umbraco.Web.UI.Client/package-lock.json
|
||||
- src/Umbraco.Web.UI.Client/src/**
|
||||
- .github/workflows/azure-storybook.yml
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- contrib
|
||||
- v*/dev
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=16384
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed' && (contains(github.event.pull_request.labels.*.name, 'preview/storybook')))
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy Job
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build And Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
production_branch: contrib
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_SEA_0C7411A03 }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
|
||||
action: "upload"
|
||||
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
|
||||
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
|
||||
app_location: "src/Umbraco.Web.UI.Client" # App source code path
|
||||
app_build_command: "npm run storybook:build"
|
||||
output_location: "/storybook-static" # Built app content directory - optional
|
||||
skip_api_build: true # Set to true if you do not have an Azure Functions API in your repo
|
||||
###### End of Repository/Build Configurations ######
|
||||
|
||||
close_pull_request_job:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Close Pull Request Job
|
||||
steps:
|
||||
- name: Close Pull Request
|
||||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
app_location: "src/Umbraco.Web.UI.Client"
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_SEA_0C7411A03 }}
|
||||
action: "close"
|
||||
Vendored
+6
-3
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"unprovide"
|
||||
]
|
||||
"cSpell.words": ["unprovide"],
|
||||
"eslint.useFlatConfig": true,
|
||||
"eslint.workingDirectories": [
|
||||
"./src/Umbraco.Web.UI.Client/",
|
||||
"./src/Umbraco.Web.UI.Login/"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
TODO: Fix and remove overrides:
|
||||
@@ -39,7 +40,7 @@
|
||||
<!-- Package Validation -->
|
||||
<PropertyGroup>
|
||||
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
|
||||
<EnablePackageValidation>true</EnablePackageValidation>
|
||||
<EnablePackageValidation>false</EnablePackageValidation>
|
||||
<PackageValidationBaselineVersion>15.0.0</PackageValidationBaselineVersion>
|
||||
<EnableStrictModeForCompatibleFrameworksInPackage>true</EnableStrictModeForCompatibleFrameworksInPackage>
|
||||
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
|
||||
|
||||
@@ -10,6 +10,7 @@ schedules:
|
||||
include:
|
||||
- v14/dev
|
||||
- v15/dev
|
||||
- v16/dev
|
||||
|
||||
variables:
|
||||
nodeVersion: 20
|
||||
@@ -428,7 +429,7 @@ stages:
|
||||
inputs:
|
||||
targetPath: $(Build.ArtifactStagingDirectory)
|
||||
artifact: "Acceptance Test Results - $(Agent.JobName) - Attempt #$(System.JobAttempt)"
|
||||
|
||||
|
||||
# Publish test results
|
||||
- task: PublishTestResults@2
|
||||
displayName: "Publish test results"
|
||||
|
||||
@@ -7,7 +7,6 @@ using Microsoft.Extensions.Options;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Umbraco.Cms.Api.Common.OpenApi;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Common.Configuration;
|
||||
@@ -18,13 +17,6 @@ public class ConfigureUmbracoSwaggerGenOptions : IConfigureOptions<SwaggerGenOpt
|
||||
private readonly ISchemaIdSelector _schemaIdSelector;
|
||||
private readonly ISubTypesSelector _subTypesSelector;
|
||||
|
||||
[Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 16.")]
|
||||
public ConfigureUmbracoSwaggerGenOptions(
|
||||
IOperationIdSelector operationIdSelector,
|
||||
ISchemaIdSelector schemaIdSelector)
|
||||
: this(operationIdSelector, schemaIdSelector, StaticServiceProvider.Instance.GetRequiredService<ISubTypesSelector>())
|
||||
{ }
|
||||
|
||||
public ConfigureUmbracoSwaggerGenOptions(
|
||||
IOperationIdSelector operationIdSelector,
|
||||
ISchemaIdSelector schemaIdSelector,
|
||||
|
||||
@@ -5,8 +5,5 @@ namespace Umbraco.Cms.Api.Common.OpenApi;
|
||||
|
||||
public interface IOperationIdSelector
|
||||
{
|
||||
[Obsolete("Use overload that only takes ApiDescription instead. This will be removed in Umbraco 15.")]
|
||||
string? OperationId(ApiDescription apiDescription, ApiVersioningOptions apiVersioningOptions);
|
||||
|
||||
string? OperationId(ApiDescription apiDescription);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@ public class OperationIdSelector : IOperationIdSelector
|
||||
public OperationIdSelector(IEnumerable<IOperationIdHandler> operationIdHandlers)
|
||||
=> _operationIdHandlers = operationIdHandlers;
|
||||
|
||||
[Obsolete("Use overload that only takes ApiDescription instead. This will be removed in Umbraco 15.")]
|
||||
public virtual string? OperationId(ApiDescription apiDescription, ApiVersioningOptions apiVersioningOptions) => OperationId(apiDescription);
|
||||
|
||||
public virtual string? OperationId(ApiDescription apiDescription)
|
||||
{
|
||||
IOperationIdHandler? handler = _operationIdHandlers.FirstOrDefault(h => h.CanHandle(apiDescription));
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace Umbraco.Cms.Api.Common.OpenApi;
|
||||
|
||||
public class SubTypesSelector : ISubTypesSelector
|
||||
{
|
||||
private readonly IOptions<GlobalSettings> _settings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IEnumerable<ISubTypesHandler> _subTypeHandlers;
|
||||
private readonly IUmbracoJsonTypeInfoResolver _umbracoJsonTypeInfoResolver;
|
||||
|
||||
[Obsolete("The settings parameter is not required anymore, use the other constructor instead. Scheduled for removal in Umbraco 17.")]
|
||||
public SubTypesSelector(
|
||||
IOptions<GlobalSettings> settings,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
@@ -23,7 +23,18 @@ public class SubTypesSelector : ISubTypesSelector
|
||||
IEnumerable<ISubTypesHandler> subTypeHandlers,
|
||||
IUmbracoJsonTypeInfoResolver umbracoJsonTypeInfoResolver)
|
||||
{
|
||||
_settings = settings;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_subTypeHandlers = subTypeHandlers;
|
||||
_umbracoJsonTypeInfoResolver = umbracoJsonTypeInfoResolver;
|
||||
}
|
||||
|
||||
public SubTypesSelector(
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IEnumerable<ISubTypesHandler> subTypeHandlers,
|
||||
IUmbracoJsonTypeInfoResolver umbracoJsonTypeInfoResolver)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_subTypeHandlers = subTypeHandlers;
|
||||
@@ -32,7 +43,7 @@ public class SubTypesSelector : ISubTypesSelector
|
||||
|
||||
public IEnumerable<Type> SubTypes(Type type)
|
||||
{
|
||||
var backOfficePath = _settings.Value.GetBackOfficePath(_hostingEnvironment);
|
||||
var backOfficePath = _hostingEnvironment.GetBackOfficePath();
|
||||
var swaggerPath = $"{backOfficePath}/swagger";
|
||||
|
||||
if (_httpContextAccessor.HttpContext?.Request.Path.StartsWithSegments(swaggerPath) ?? false)
|
||||
|
||||
@@ -7,7 +7,7 @@ using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.Web.Common.ApplicationBuilder;
|
||||
using Umbraco.Extensions;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
@@ -30,24 +30,21 @@ public class SwaggerRouteTemplatePipelineFilter : UmbracoPipelineFilter
|
||||
IOptions<SwaggerGenOptions> swaggerGenOptions = applicationBuilder.ApplicationServices.GetRequiredService<IOptions<SwaggerGenOptions>>();
|
||||
|
||||
applicationBuilder.UseSwagger(swaggerOptions =>
|
||||
{
|
||||
swaggerOptions.RouteTemplate = SwaggerRouteTemplate(applicationBuilder);
|
||||
});
|
||||
{
|
||||
swaggerOptions.RouteTemplate = SwaggerRouteTemplate(applicationBuilder);
|
||||
});
|
||||
|
||||
applicationBuilder.UseSwaggerUI(swaggerUiOptions => SwaggerUiConfiguration(swaggerUiOptions, swaggerGenOptions.Value, applicationBuilder));
|
||||
}
|
||||
|
||||
protected virtual bool SwaggerIsEnabled(IApplicationBuilder applicationBuilder)
|
||||
{
|
||||
IWebHostEnvironment webHostEnvironment = applicationBuilder.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
|
||||
return webHostEnvironment.IsProduction() is false;
|
||||
}
|
||||
=> applicationBuilder.ApplicationServices.GetRequiredService<IWebHostEnvironment>().IsProduction() is false;
|
||||
|
||||
protected virtual string SwaggerRouteTemplate(IApplicationBuilder applicationBuilder)
|
||||
=> $"{GetUmbracoPath(applicationBuilder).TrimStart(Constants.CharArrays.ForwardSlash)}/swagger/{{documentName}}/swagger.json";
|
||||
=> $"{GetBackOfficePath(applicationBuilder).TrimStart(Constants.CharArrays.ForwardSlash)}/swagger/{{documentName}}/swagger.json";
|
||||
|
||||
protected virtual string SwaggerUiRoutePrefix(IApplicationBuilder applicationBuilder)
|
||||
=> $"{GetUmbracoPath(applicationBuilder).TrimStart(Constants.CharArrays.ForwardSlash)}/swagger";
|
||||
=> $"{GetBackOfficePath(applicationBuilder).TrimStart(Constants.CharArrays.ForwardSlash)}/swagger";
|
||||
|
||||
protected virtual void SwaggerUiConfiguration(
|
||||
SwaggerUIOptions swaggerUiOptions,
|
||||
@@ -56,8 +53,7 @@ public class SwaggerRouteTemplatePipelineFilter : UmbracoPipelineFilter
|
||||
{
|
||||
swaggerUiOptions.RoutePrefix = SwaggerUiRoutePrefix(applicationBuilder);
|
||||
|
||||
foreach ((var name, OpenApiInfo? apiInfo) in swaggerGenOptions.SwaggerGeneratorOptions.SwaggerDocs
|
||||
.OrderBy(x => x.Value.Title))
|
||||
foreach ((var name, OpenApiInfo? apiInfo) in swaggerGenOptions.SwaggerGeneratorOptions.SwaggerDocs.OrderBy(x => x.Value.Title))
|
||||
{
|
||||
swaggerUiOptions.SwaggerEndpoint($"{name}/swagger.json", $"{apiInfo.Title}");
|
||||
}
|
||||
@@ -70,11 +66,6 @@ public class SwaggerRouteTemplatePipelineFilter : UmbracoPipelineFilter
|
||||
swaggerUiOptions.OAuthUsePkce();
|
||||
}
|
||||
|
||||
private string GetUmbracoPath(IApplicationBuilder applicationBuilder)
|
||||
{
|
||||
GlobalSettings settings = applicationBuilder.ApplicationServices.GetRequiredService<IOptions<GlobalSettings>>().Value;
|
||||
IHostingEnvironment hostingEnvironment = applicationBuilder.ApplicationServices.GetRequiredService<IHostingEnvironment>();
|
||||
|
||||
return settings.GetBackOfficePath(hostingEnvironment);
|
||||
}
|
||||
private string GetBackOfficePath(IApplicationBuilder applicationBuilder)
|
||||
=> applicationBuilder.ApplicationServices.GetRequiredService<IHostingEnvironment>().GetBackOfficePath();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Diagnostics;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -8,7 +7,6 @@ using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Content;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByIdContentApiController : ContentApiItemControllerBase
|
||||
{
|
||||
@@ -21,16 +19,6 @@ public class ByIdContentApiController : ContentApiItemControllerBase
|
||||
: base(apiPublishedContentCache, apiContentResponseBuilder)
|
||||
=> _requestMemberAccessService = requestMemberAccessService;
|
||||
|
||||
[HttpGet("item/{id:guid}")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IApiContentResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> ById(Guid id)
|
||||
=> await HandleRequest(id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a content item by id.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,6 @@ using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Content;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByIdsContentApiController : ContentApiItemControllerBase
|
||||
{
|
||||
@@ -21,15 +20,6 @@ public class ByIdsContentApiController : ContentApiItemControllerBase
|
||||
: base(apiPublishedContentCache, apiContentResponseBuilder)
|
||||
=> _requestMemberAccessService = requestMemberAccessService;
|
||||
|
||||
[HttpGet("item")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<IApiContentResponse>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> Item([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
=> await HandleRequest(ids);
|
||||
|
||||
/// <summary>
|
||||
/// Gets content items by ids.
|
||||
/// </summary>
|
||||
@@ -58,6 +48,6 @@ public class ByIdsContentApiController : ContentApiItemControllerBase
|
||||
.WhereNotNull()
|
||||
.ToArray();
|
||||
|
||||
return await Task.FromResult(Ok(apiContentItems));
|
||||
return Ok(apiContentItems);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.DeliveryApi;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Models.DeliveryApi;
|
||||
using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Content;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByRouteContentApiController : ContentApiItemControllerBase
|
||||
{
|
||||
@@ -21,45 +17,6 @@ public class ByRouteContentApiController : ContentApiItemControllerBase
|
||||
private readonly IRequestMemberAccessService _requestMemberAccessService;
|
||||
private const string PreviewContentRequestPathPrefix = $"/{Constants.DeliveryApi.Routing.PreviewContentPathPrefix}";
|
||||
|
||||
[Obsolete($"Please use the constructor that accepts {nameof(IApiContentPathResolver)}. Will be removed in V15.")]
|
||||
public ByRouteContentApiController(
|
||||
IApiPublishedContentCache apiPublishedContentCache,
|
||||
IApiContentResponseBuilder apiContentResponseBuilder,
|
||||
IRequestRoutingService requestRoutingService,
|
||||
IRequestRedirectService requestRedirectService,
|
||||
IRequestPreviewService requestPreviewService,
|
||||
IRequestMemberAccessService requestMemberAccessService)
|
||||
: this(
|
||||
apiPublishedContentCache,
|
||||
apiContentResponseBuilder,
|
||||
requestRedirectService,
|
||||
requestPreviewService,
|
||||
requestMemberAccessService,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IApiContentPathResolver>())
|
||||
{
|
||||
}
|
||||
|
||||
[Obsolete($"Please use the non-obsolete constructor. Will be removed in V15.")]
|
||||
public ByRouteContentApiController(
|
||||
IApiPublishedContentCache apiPublishedContentCache,
|
||||
IApiContentResponseBuilder apiContentResponseBuilder,
|
||||
IPublicAccessService publicAccessService,
|
||||
IRequestRoutingService requestRoutingService,
|
||||
IRequestRedirectService requestRedirectService,
|
||||
IRequestPreviewService requestPreviewService,
|
||||
IRequestMemberAccessService requestMemberAccessService,
|
||||
IApiContentPathResolver apiContentPathResolver)
|
||||
: this(
|
||||
apiPublishedContentCache,
|
||||
apiContentResponseBuilder,
|
||||
requestRedirectService,
|
||||
requestPreviewService,
|
||||
requestMemberAccessService,
|
||||
apiContentPathResolver)
|
||||
{
|
||||
}
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public ByRouteContentApiController(
|
||||
IApiPublishedContentCache apiPublishedContentCache,
|
||||
IApiContentResponseBuilder apiContentResponseBuilder,
|
||||
@@ -75,16 +32,6 @@ public class ByRouteContentApiController : ContentApiItemControllerBase
|
||||
_apiContentPathResolver = apiContentPathResolver;
|
||||
}
|
||||
|
||||
[HttpGet("item/{*path}")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IApiContentResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> ByRoute(string path = "")
|
||||
=> await HandleRequest(path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a content item by route.
|
||||
/// </summary>
|
||||
@@ -117,7 +64,7 @@ public class ByRouteContentApiController : ContentApiItemControllerBase
|
||||
return deniedAccessResult;
|
||||
}
|
||||
|
||||
return await Task.FromResult(Ok(ApiContentResponseBuilder.Build(contentItem)));
|
||||
return Ok(ApiContentResponseBuilder.Build(contentItem));
|
||||
}
|
||||
|
||||
IApiContentRoute? redirectRoute = _requestRedirectService.GetRedirectRoute(path);
|
||||
|
||||
@@ -12,7 +12,6 @@ using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Content;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class QueryContentApiController : ContentApiControllerBase
|
||||
{
|
||||
@@ -30,20 +29,6 @@ public class QueryContentApiController : ContentApiControllerBase
|
||||
_requestMemberAccessService = requestMemberAccessService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<IApiContentResponse>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> Query(
|
||||
string? fetch,
|
||||
[FromQuery] string[] filter,
|
||||
[FromQuery] string[] sort,
|
||||
int skip = 0,
|
||||
int take = 10)
|
||||
=> await HandleRequest(fetch, filter, sort, skip, take);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a paginated list of content item(s) from query.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Models.DeliveryApi;
|
||||
@@ -8,7 +8,6 @@ using Umbraco.Cms.Infrastructure.DeliveryApi;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Media;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByIdMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
@@ -19,14 +18,6 @@ public class ByIdMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet("item/{id:guid}")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IApiMediaWithCropsResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> ById(Guid id)
|
||||
=> await HandleRequest(id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a media item by id.
|
||||
/// </summary>
|
||||
@@ -36,16 +27,16 @@ public class ByIdMediaApiController : MediaApiControllerBase
|
||||
[MapToApiVersion("2.0")]
|
||||
[ProducesResponseType(typeof(IApiMediaWithCropsResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> ByIdV20(Guid id)
|
||||
=> await HandleRequest(id);
|
||||
public Task<IActionResult> ByIdV20(Guid id)
|
||||
=> Task.FromResult(HandleRequest(id));
|
||||
|
||||
private async Task<IActionResult> HandleRequest(Guid id)
|
||||
private IActionResult HandleRequest(Guid id)
|
||||
{
|
||||
IPublishedContent? media = PublishedMediaCache.GetById(id);
|
||||
|
||||
if (media is null)
|
||||
{
|
||||
return await Task.FromResult(NotFound());
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(BuildApiMediaWithCrops(media));
|
||||
|
||||
@@ -9,7 +9,6 @@ using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Media;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByIdsMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
@@ -18,13 +17,6 @@ public class ByIdsMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet("item")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<IApiMediaWithCropsResponse>), StatusCodes.Status200OK)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> Item([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
=> await HandleRequest(ids);
|
||||
|
||||
/// <summary>
|
||||
/// Gets media items by ids.
|
||||
/// </summary>
|
||||
@@ -33,10 +25,10 @@ public class ByIdsMediaApiController : MediaApiControllerBase
|
||||
[HttpGet("items")]
|
||||
[MapToApiVersion("2.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<IApiMediaWithCropsResponse>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> ItemsV20([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
=> await HandleRequest(ids);
|
||||
public Task<IActionResult> ItemsV20([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
=> Task.FromResult(HandleRequest(ids));
|
||||
|
||||
private async Task<IActionResult> HandleRequest(HashSet<Guid> ids)
|
||||
private IActionResult HandleRequest(HashSet<Guid> ids)
|
||||
{
|
||||
IPublishedContent[] mediaItems = ids
|
||||
.Select(PublishedMediaCache.GetById)
|
||||
@@ -47,6 +39,6 @@ public class ByIdsMediaApiController : MediaApiControllerBase
|
||||
.Select(BuildApiMediaWithCrops)
|
||||
.ToArray();
|
||||
|
||||
return await Task.FromResult(Ok(apiMediaItems));
|
||||
return Ok(apiMediaItems);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.DeliveryApi;
|
||||
@@ -9,7 +9,6 @@ using Umbraco.Cms.Infrastructure.DeliveryApi;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Media;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class ByPathMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
@@ -22,14 +21,6 @@ public class ByPathMediaApiController : MediaApiControllerBase
|
||||
: base(publishedMediaCache, apiMediaWithCropsResponseBuilder)
|
||||
=> _apiMediaQueryService = apiMediaQueryService;
|
||||
|
||||
[HttpGet("item/{*path}")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IApiMediaWithCropsResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> ByPath(string path)
|
||||
=> await HandleRequest(path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a media item by its path.
|
||||
/// </summary>
|
||||
@@ -39,17 +30,17 @@ public class ByPathMediaApiController : MediaApiControllerBase
|
||||
[MapToApiVersion("2.0")]
|
||||
[ProducesResponseType(typeof(IApiMediaWithCropsResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> ByPathV20(string path)
|
||||
=> await HandleRequest(path);
|
||||
public Task<IActionResult> ByPathV20(string path)
|
||||
=> Task.FromResult(HandleRequest(path));
|
||||
|
||||
private async Task<IActionResult> HandleRequest(string path)
|
||||
private IActionResult HandleRequest(string path)
|
||||
{
|
||||
path = DecodePath(path);
|
||||
|
||||
IPublishedContent? media = _apiMediaQueryService.GetByPath(path);
|
||||
if (media is null)
|
||||
{
|
||||
return await Task.FromResult(NotFound());
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(BuildApiMediaWithCrops(media));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
@@ -14,7 +14,6 @@ using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Delivery.Controllers.Media;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("2.0")]
|
||||
public class QueryMediaApiController : MediaApiControllerBase
|
||||
{
|
||||
@@ -27,19 +26,6 @@ public class QueryMediaApiController : MediaApiControllerBase
|
||||
: base(publishedMediaCache, apiMediaWithCropsResponseBuilder)
|
||||
=> _apiMediaQueryService = apiMediaQueryService;
|
||||
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<IApiMediaWithCropsResponse>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[Obsolete("Please use version 2 of this API. Will be removed in V15.")]
|
||||
public async Task<IActionResult> Query(
|
||||
string? fetch,
|
||||
[FromQuery] string[] filter,
|
||||
[FromQuery] string[] sort,
|
||||
int skip = 0,
|
||||
int take = 10)
|
||||
=> await HandleRequest(fetch, filter, sort, skip, take);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a paginated list of media item(s) from query.
|
||||
/// </summary>
|
||||
@@ -53,15 +39,15 @@ public class QueryMediaApiController : MediaApiControllerBase
|
||||
[MapToApiVersion("2.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<IApiMediaWithCropsResponse>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> QueryV20(
|
||||
public Task<IActionResult> QueryV20(
|
||||
string? fetch,
|
||||
[FromQuery] string[] filter,
|
||||
[FromQuery] string[] sort,
|
||||
int skip = 0,
|
||||
int take = 10)
|
||||
=> await HandleRequest(fetch, filter, sort, skip, take);
|
||||
=> Task.FromResult(HandleRequest(fetch, filter, sort, skip, take));
|
||||
|
||||
private async Task<IActionResult> HandleRequest(string? fetch, string[] filter, string[] sort, int skip, int take)
|
||||
private IActionResult HandleRequest(string? fetch, string[] filter, string[] sort, int skip, int take)
|
||||
{
|
||||
Attempt<PagedModel<Guid>, ApiMediaQueryOperationStatus> queryAttempt = _apiMediaQueryService.ExecuteQuery(fetch, filter, sort, skip, take);
|
||||
|
||||
@@ -79,6 +65,6 @@ public class QueryMediaApiController : MediaApiControllerBase
|
||||
Items = mediaItems.Select(BuildApiMediaWithCrops)
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(model));
|
||||
return Ok(model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using OpenIddict.Abstractions;
|
||||
@@ -13,7 +12,6 @@ using OpenIddict.Server.AspNetCore;
|
||||
using Umbraco.Cms.Api.Delivery.Routing;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
using Umbraco.Cms.Web.Common.Security;
|
||||
using Umbraco.Extensions;
|
||||
@@ -33,31 +31,6 @@ public class MemberController : DeliveryApiControllerBase
|
||||
private readonly DeliveryApiSettings _deliveryApiSettings;
|
||||
private readonly ILogger<MemberController> _logger;
|
||||
|
||||
|
||||
[Obsolete("Please use the non-obsolete constructor. Will be removed in V16.")]
|
||||
public MemberController(
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IMemberSignInManager memberSignInManager,
|
||||
IMemberManager memberManager,
|
||||
IOptions<DeliveryApiSettings> deliveryApiSettings,
|
||||
ILogger<MemberController> logger)
|
||||
: this(memberSignInManager, memberManager, StaticServiceProvider.Instance.GetRequiredService<IMemberClientCredentialsManager>(), deliveryApiSettings, logger)
|
||||
{
|
||||
}
|
||||
|
||||
[Obsolete("Please use the non-obsolete constructor. Will be removed in V16.")]
|
||||
public MemberController(
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IMemberSignInManager memberSignInManager,
|
||||
IMemberManager memberManager,
|
||||
IMemberClientCredentialsManager memberClientCredentialsManager,
|
||||
IOptions<DeliveryApiSettings> deliveryApiSettings,
|
||||
ILogger<MemberController> logger)
|
||||
: this(memberSignInManager, memberManager, memberClientCredentialsManager, deliveryApiSettings, logger)
|
||||
{
|
||||
}
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public MemberController(
|
||||
IMemberSignInManager memberSignInManager,
|
||||
IMemberManager memberManager,
|
||||
|
||||
@@ -62,7 +62,6 @@ public static class UmbracoBuilderExtensions
|
||||
builder.Services.AddTransient<IMemberApplicationManager, MemberApplicationManager>();
|
||||
builder.Services.AddTransient<IRequestMemberAccessService, RequestMemberAccessService>();
|
||||
builder.Services.AddTransient<ICurrentMemberClaimsProvider, CurrentMemberClaimsProvider>();
|
||||
builder.Services.AddScoped<IMemberClientCredentialsManager, MemberClientCredentialsManager>();
|
||||
|
||||
builder.Services.ConfigureOptions<ConfigureUmbracoDeliveryApiSwaggerGenOptions>();
|
||||
builder.AddUmbracoApiOpenApiUI();
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ internal sealed class InitializeMemberApplicationNotificationHandler : INotifica
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateRedirectUrls(Uri[] redirectUrls)
|
||||
private bool ValidateRedirectUrls(IEnumerable<Uri> redirectUrls)
|
||||
{
|
||||
if (redirectUrls.Any() is false)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BackOfficeLoginModel
|
||||
public bool UserIsAlreadyLoggedIn { get; set; }
|
||||
}
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi=true)]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[Route(LoginPath)]
|
||||
public class BackOfficeLoginController : Controller
|
||||
{
|
||||
@@ -51,7 +51,7 @@ public class BackOfficeLoginController : Controller
|
||||
|
||||
if (string.IsNullOrEmpty(model.UmbracoUrl))
|
||||
{
|
||||
model.UmbracoUrl = _hostingEnvironment.ToAbsolute(Constants.System.DefaultUmbracoPath);
|
||||
model.UmbracoUrl = _hostingEnvironment.GetBackOfficePath();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.ReturnUrl))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -28,7 +28,7 @@ public class AllCultureController : CultureControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<CultureReponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<PagedViewModel<CultureReponseModel>> GetAll(CancellationToken cancellationToken, int skip = 0, int take = 100)
|
||||
public Task<PagedViewModel<CultureReponseModel>> GetAll(CancellationToken cancellationToken, int skip = 0, int take = 100)
|
||||
{
|
||||
CultureInfo[] all = _cultureService.GetValidCultureInfos();
|
||||
|
||||
@@ -38,6 +38,6 @@ public class AllCultureController : CultureControllerBase
|
||||
Total = all.Length
|
||||
};
|
||||
|
||||
return await Task.FromResult(viewModel);
|
||||
return Task.FromResult(viewModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
@@ -38,6 +38,6 @@ public class AllDictionaryController : DictionaryControllerBase
|
||||
Total = items.Length,
|
||||
Items = _umbracoMapper.MapEnumerable<IDictionaryItem, DictionaryOverviewResponseModel>(items.Skip(skip).Take(take))
|
||||
};
|
||||
return await Task.FromResult(model);
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -28,7 +28,7 @@ public class DictionaryTreeControllerBase : NamedEntityTreeControllerBase<NamedE
|
||||
protected IDictionaryItemService DictionaryItemService { get; }
|
||||
|
||||
protected async Task<IEnumerable<NamedEntityTreeItemResponseModel>> MapTreeItemViewModels(IEnumerable<IDictionaryItem> dictionaryItems)
|
||||
=> await Task.WhenAll(dictionaryItems.Select(CreateEntityTreeItemViewModelAsync));
|
||||
=> await MapTreeItemViewModelsAsync(dictionaryItems).ToArrayAsync();
|
||||
|
||||
protected override async Task<ActionResult<IEnumerable<NamedEntityTreeItemResponseModel>>> GetAncestors(Guid descendantKey, bool includeSelf = true)
|
||||
{
|
||||
@@ -54,10 +54,19 @@ public class DictionaryTreeControllerBase : NamedEntityTreeControllerBase<NamedE
|
||||
}
|
||||
}
|
||||
|
||||
NamedEntityTreeItemResponseModel[] viewModels = await Task.WhenAll(ancestors.Select(CreateEntityTreeItemViewModelAsync));
|
||||
NamedEntityTreeItemResponseModel[] viewModels = await MapTreeItemViewModelsAsync(ancestors).ToArrayAsync();
|
||||
|
||||
return Ok(viewModels.Reverse());
|
||||
}
|
||||
|
||||
private async IAsyncEnumerable<NamedEntityTreeItemResponseModel> MapTreeItemViewModelsAsync(IEnumerable<IDictionaryItem> dictionaryItems)
|
||||
{
|
||||
foreach (IDictionaryItem dictionaryItem in dictionaryItems)
|
||||
{
|
||||
yield return await CreateEntityTreeItemViewModelAsync(dictionaryItem);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<NamedEntityTreeItemResponseModel> CreateEntityTreeItemViewModelAsync(IDictionaryItem dictionaryItem)
|
||||
{
|
||||
var hasChildren = await DictionaryItemService.CountChildrenAsync(dictionaryItem.Key) > 0;
|
||||
|
||||
-16
@@ -1,12 +1,10 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Document.Collection;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
@@ -22,20 +20,6 @@ public class ByKeyDocumentCollectionController : DocumentCollectionControllerBas
|
||||
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
|
||||
private readonly IDocumentCollectionPresentationFactory _documentCollectionPresentationFactory;
|
||||
|
||||
[Obsolete("Please use the constructor taking all parameters.")]
|
||||
public ByKeyDocumentCollectionController(
|
||||
IContentListViewService contentListViewService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
|
||||
IUmbracoMapper mapper)
|
||||
: this(
|
||||
contentListViewService,
|
||||
backOfficeSecurityAccessor,
|
||||
mapper,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IDocumentCollectionPresentationFactory>())
|
||||
{
|
||||
}
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public ByKeyDocumentCollectionController(
|
||||
IContentListViewService contentListViewService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -24,13 +24,13 @@ public class ItemDocumentItemController : DocumentItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DocumentItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<DocumentItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<DocumentItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IDocumentEntitySlim> documents = _entityService
|
||||
@@ -38,6 +38,6 @@ public class ItemDocumentItemController : DocumentItemControllerBase
|
||||
.OfType<IDocumentEntitySlim>();
|
||||
|
||||
IEnumerable<DocumentItemResponseModel> documentItemResponseModels = documents.Select(_documentPresentationFactory.CreateItemResponseModel);
|
||||
return await Task.FromResult(Ok(documentItemResponseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(documentItemResponseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-25
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -22,32 +21,10 @@ public class SearchDocumentItemController : DocumentItemControllerBase
|
||||
_documentPresentationFactory = documentPresentationFactory;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
=> await SearchFromParent(cancellationToken, query, skip, take);
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
|
||||
=> await SearchWithTrashed(cancellationToken, query, null, skip, take, parentId);
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
[ProducesResponseType(typeof(PagedModel<DocumentItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> SearchFromParentWithAllowedTypes(
|
||||
CancellationToken cancellationToken,
|
||||
string query,
|
||||
int skip = 0,
|
||||
int take = 100,
|
||||
Guid? parentId = null,
|
||||
[FromQuery] IEnumerable<Guid>? allowedDocumentTypes = null) =>
|
||||
await SearchWithTrashed(cancellationToken, query, null, skip, take, parentId, allowedDocumentTypes);
|
||||
|
||||
[HttpGet("search")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedModel<DocumentItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> SearchWithTrashed(
|
||||
public Task<IActionResult> SearchWithTrashed(
|
||||
CancellationToken cancellationToken,
|
||||
string query,
|
||||
bool? trashed = null,
|
||||
@@ -63,6 +40,6 @@ public class SearchDocumentItemController : DocumentItemControllerBase
|
||||
Total = searchResult.Total,
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<IActionResult>(Ok(result));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Document;
|
||||
@@ -35,6 +35,6 @@ public class UpdateNotificationsController : DocumentControllerBase
|
||||
}
|
||||
|
||||
_notificationService.SetNotifications(_backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser, content, updateModel.SubscribedActionIds);
|
||||
return await Task.FromResult(Ok());
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
-26
@@ -14,7 +14,6 @@ using Umbraco.Cms.Core.Services.OperationStatus;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Document;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[ApiVersion("1.1")]
|
||||
public class ValidateUpdateDocumentController : UpdateDocumentControllerBase
|
||||
{
|
||||
@@ -48,31 +47,6 @@ public class ValidateUpdateDocumentController : UpdateDocumentControllerBase
|
||||
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
|
||||
}
|
||||
|
||||
[HttpPut("{id:guid}/validate")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[Obsolete("Please use version 1.1 of this API. Will be removed in V16.")]
|
||||
public async Task<IActionResult> Validate(CancellationToken cancellationToken, Guid id, UpdateDocumentRequestModel requestModel)
|
||||
=> await HandleRequest(id, requestModel, async () =>
|
||||
{
|
||||
var validateUpdateDocumentRequestModel = new ValidateUpdateDocumentRequestModel
|
||||
{
|
||||
Values = requestModel.Values,
|
||||
Variants = requestModel.Variants,
|
||||
Template = requestModel.Template,
|
||||
Cultures = null
|
||||
};
|
||||
|
||||
ValidateContentUpdateModel model = _documentEditingPresentationFactory.MapValidateUpdateModel(validateUpdateDocumentRequestModel);
|
||||
Attempt<ContentValidationResult, ContentEditingOperationStatus> result = await _contentEditingService.ValidateUpdateAsync(id, model);
|
||||
|
||||
return result.Success
|
||||
? Ok()
|
||||
: DocumentEditingOperationStatusResult(result.Status, requestModel, result.Result);
|
||||
});
|
||||
|
||||
[HttpPut("{id:guid}/validate")]
|
||||
[MapToApiVersion("1.1")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -25,13 +25,13 @@ public class ItemDocumentBlueprintController : DocumentBlueprintItemControllerBa
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DocumentBlueprintItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<DocumentBlueprintItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<DocumentBlueprintItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IDocumentEntitySlim> documents = _entityService
|
||||
@@ -39,6 +39,6 @@ public class ItemDocumentBlueprintController : DocumentBlueprintItemControllerBa
|
||||
.Select(x => x as IDocumentEntitySlim)
|
||||
.WhereNotNull();
|
||||
IEnumerable<DocumentBlueprintItemResponseModel> responseModels = documents.Select(x => _documentPresentationFactory.CreateBlueprintItemResponseModel(x));
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
-9
@@ -23,15 +23,6 @@ public class AllowedChildrenDocumentTypeController : DocumentTypeControllerBase
|
||||
_umbracoMapper = umbracoMapper;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Use the non obsoleted method instead. Scheduled to be removed in v16")]
|
||||
public async Task<IActionResult> AllowedChildrenByKey(
|
||||
CancellationToken cancellationToken,
|
||||
Guid id,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
=> await AllowedChildrenByKey(cancellationToken, id, null, skip, take);
|
||||
|
||||
[HttpGet("{id:guid}/allowed-children")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<AllowedDocumentType>), StatusCodes.Status200OK)]
|
||||
|
||||
+2
-29
@@ -1,14 +1,9 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Features;
|
||||
using Umbraco.Cms.Web.Common.Authorization;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
|
||||
@@ -19,30 +14,8 @@ public class ConfigurationDocumentTypeController : DocumentTypeControllerBase
|
||||
{
|
||||
private readonly IConfigurationPresentationFactory _configurationPresentationFactory;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public ConfigurationDocumentTypeController(IConfigurationPresentationFactory configurationPresentationFactory)
|
||||
{
|
||||
_configurationPresentationFactory = configurationPresentationFactory;
|
||||
}
|
||||
|
||||
[Obsolete("Use the constructor that only accepts IConfigurationPresentationFactory, scheduled for removal in V16")]
|
||||
public ConfigurationDocumentTypeController(
|
||||
UmbracoFeatures umbracoFeatures,
|
||||
IOptionsSnapshot<DataTypesSettings> dataTypesSettings,
|
||||
IOptionsSnapshot<SegmentSettings> segmentSettings,
|
||||
IConfigurationPresentationFactory configurationPresentationFactory)
|
||||
: this(configurationPresentationFactory)
|
||||
{
|
||||
}
|
||||
|
||||
[Obsolete("Use the constructor that only accepts IConfigurationPresentationFactory, scheduled for removal in V16")]
|
||||
public ConfigurationDocumentTypeController(
|
||||
UmbracoFeatures umbracoFeatures,
|
||||
IOptionsSnapshot<DataTypesSettings> dataTypesSettings,
|
||||
IOptionsSnapshot<SegmentSettings> segmentSettings)
|
||||
: this(StaticServiceProvider.Instance.GetRequiredService<IConfigurationPresentationFactory>())
|
||||
{
|
||||
}
|
||||
=> _configurationPresentationFactory = configurationPresentationFactory;
|
||||
|
||||
[HttpGet("configuration")]
|
||||
[MapToApiVersion("1.0")]
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.DocumentType.Item;
|
||||
@@ -23,17 +23,17 @@ public class ItemDocumentTypeItemController : DocumentTypeItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DocumentTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<DocumentTypeItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<DocumentTypeItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IContentType> contentTypes = _contentTypeService.GetMany(ids);
|
||||
List<DocumentTypeItemResponseModel> responseModels = _mapper.MapEnumerable<IContentType, DocumentTypeItemResponseModel>(contentTypes);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
-15
@@ -2,10 +2,8 @@ using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Actions;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
using Umbraco.Cms.Core.Security.Authorization;
|
||||
@@ -23,7 +21,6 @@ public class RollbackDocumentVersionController : DocumentVersionControllerBase
|
||||
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public RollbackDocumentVersionController(
|
||||
IContentVersionService contentVersionService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
|
||||
@@ -34,18 +31,6 @@ public class RollbackDocumentVersionController : DocumentVersionControllerBase
|
||||
_authorizationService = authorizationService;
|
||||
}
|
||||
|
||||
// TODO (V16): Remove this constructor.
|
||||
[Obsolete("Please use the constructor taking all parameters. This constructor will be removed in V16.")]
|
||||
public RollbackDocumentVersionController(
|
||||
IContentVersionService contentVersionService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor)
|
||||
: this(
|
||||
contentVersionService,
|
||||
backOfficeSecurityAccessor,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IAuthorizationService>())
|
||||
{
|
||||
}
|
||||
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpPost("{id:guid}/rollback")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
|
||||
@@ -21,10 +21,10 @@ public class GetQueryStepsController : DynamicRootControllerBase
|
||||
[HttpGet($"steps")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<string>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> GetQuerySteps(CancellationToken cancellationToken)
|
||||
public Task<IActionResult> GetQuerySteps(CancellationToken cancellationToken)
|
||||
{
|
||||
IEnumerable<string> querySteps = _dynamicRootQueryStepCollection.Select(x => x.SupportedDirectionAlias);
|
||||
|
||||
return await Task.FromResult(Ok(querySteps));
|
||||
return Task.FromResult<IActionResult>(Ok(querySteps));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,6 +63,6 @@ public class ExecuteActionHealthCheckController : HealthCheckControllerBase
|
||||
|
||||
HealthCheckStatus result = await healthCheck.ExecuteActionAsync(_umbracoMapper.Map<HealthCheckAction>(action)!);
|
||||
|
||||
return await Task.FromResult(Ok(_umbracoMapper.Map<HealthCheckResultResponseModel>(result)));
|
||||
return Ok(_umbracoMapper.Map<HealthCheckResultResponseModel>(result));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ public class AllHealthCheckGroupController : HealthCheckGroupControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<HealthCheckGroupResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<HealthCheckGroupResponseModel>>> All(
|
||||
public Task<ActionResult<PagedViewModel<HealthCheckGroupResponseModel>>> All(
|
||||
CancellationToken cancellationToken,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
@@ -46,6 +46,6 @@ public class AllHealthCheckGroupController : HealthCheckGroupControllerBase
|
||||
Items = _umbracoMapper.MapEnumerable<IGrouping<string?, Core.HealthChecks.HealthCheck>, HealthCheckGroupResponseModel>(groups.Skip(skip).Take(take))
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<HealthCheckGroupResponseModel>>>(Ok(viewModel));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ public class ByNameHealthCheckGroupController : HealthCheckGroupControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(HealthCheckGroupPresentationModel), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> ByName(
|
||||
public Task<IActionResult> ByName(
|
||||
CancellationToken cancellationToken,
|
||||
string name)
|
||||
{
|
||||
@@ -42,9 +42,9 @@ public class ByNameHealthCheckGroupController : HealthCheckGroupControllerBase
|
||||
|
||||
if (group is null)
|
||||
{
|
||||
return HealthCheckGroupNotFound();
|
||||
return Task.FromResult(HealthCheckGroupNotFound());
|
||||
}
|
||||
|
||||
return await Task.FromResult(Ok(_umbracoMapper.Map<HealthCheckGroupPresentationModel>(group)));
|
||||
return Task.FromResult<IActionResult>(Ok(_umbracoMapper.Map<HealthCheckGroupPresentationModel>(group)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -82,6 +82,5 @@ public class GetHelpController : HelpControllerBase
|
||||
return Ok(PagedViewModel<HelpPageResponseModel>.Empty());
|
||||
}
|
||||
|
||||
private bool IsAllowedUrl(string? url) =>
|
||||
_helpPageSettings.HelpPageUrlAllowList is null || _helpPageSettings.HelpPageUrlAllowList.Contains(url);
|
||||
private bool IsAllowedUrl(string? url) => url is null || _helpPageSettings.HelpPageUrlAllowList.Contains(url);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Examine;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -34,11 +34,11 @@ public class DetailsIndexerController : IndexerControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(IndexResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<IndexResponseModel?>> Details(CancellationToken cancellationToken, string indexName)
|
||||
public Task<ActionResult<IndexResponseModel?>> Details(CancellationToken cancellationToken, string indexName)
|
||||
{
|
||||
if (_examineManager.TryGetIndex(indexName, out IIndex? index))
|
||||
{
|
||||
return await Task.FromResult(_indexPresentationFactory.Create(index!));
|
||||
return Task.FromResult<ActionResult<IndexResponseModel?>>(_indexPresentationFactory.Create(index));
|
||||
}
|
||||
|
||||
var invalidModelProblem = new ProblemDetails
|
||||
@@ -49,7 +49,6 @@ public class DetailsIndexerController : IndexerControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return await Task.FromResult(NotFound(invalidModelProblem));
|
||||
|
||||
return Task.FromResult<ActionResult<IndexResponseModel?>>(NotFound(invalidModelProblem));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RebuildIndexerController : IndexerControllerBase
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Rebuild(CancellationToken cancellationToken, string indexName)
|
||||
public Task<IActionResult> Rebuild(CancellationToken cancellationToken, string indexName)
|
||||
{
|
||||
if (!_examineManager.TryGetIndex(indexName, out IIndex? index))
|
||||
{
|
||||
@@ -48,7 +48,7 @@ public class RebuildIndexerController : IndexerControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return await Task.FromResult(NotFound(invalidModelProblem));
|
||||
return Task.FromResult<IActionResult>(NotFound(invalidModelProblem));
|
||||
}
|
||||
|
||||
if (!_indexingRebuilderService.CanRebuild(index.Name))
|
||||
@@ -62,14 +62,14 @@ public class RebuildIndexerController : IndexerControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return await Task.FromResult(BadRequest(invalidModelProblem));
|
||||
return Task.FromResult<IActionResult>(BadRequest(invalidModelProblem));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Rebuilding index '{IndexName}'", indexName);
|
||||
|
||||
if (_indexingRebuilderService.TryRebuild(index, indexName))
|
||||
{
|
||||
return await Task.FromResult(Ok());
|
||||
return Task.FromResult<IActionResult>(Ok());
|
||||
}
|
||||
|
||||
var problemDetails = new ProblemDetails
|
||||
@@ -80,6 +80,6 @@ public class RebuildIndexerController : IndexerControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return await Task.FromResult(Conflict(problemDetails));
|
||||
return Task.FromResult<IActionResult>(Conflict(problemDetails));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ public class AllSinkLevelLogViewerController : LogViewerControllerBase
|
||||
[HttpGet("level")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<LoggerResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<LoggerResponseModel>>> AllLogLevels(
|
||||
public Task<ActionResult<PagedViewModel<LoggerResponseModel>>> AllLogLevels(
|
||||
CancellationToken cancellationToken,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
@@ -45,6 +45,6 @@ public class AllSinkLevelLogViewerController : LogViewerControllerBase
|
||||
Items = _umbracoMapper.MapEnumerable<KeyValuePair<string, LogLevel>, LoggerResponseModel>(logLevels.Skip(skip).Take(take))
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<LoggerResponseModel>>>(Ok(viewModel));
|
||||
}
|
||||
}
|
||||
|
||||
-16
@@ -1,12 +1,10 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Media.Collection;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
@@ -22,20 +20,6 @@ public class ByKeyMediaCollectionController : MediaCollectionControllerBase
|
||||
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
|
||||
private readonly IMediaCollectionPresentationFactory _mediaCollectionPresentationFactory;
|
||||
|
||||
[Obsolete("Please use the constructor taking all parameters.")]
|
||||
public ByKeyMediaCollectionController(
|
||||
IMediaListViewService mediaListViewService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
|
||||
IUmbracoMapper mapper)
|
||||
: this(
|
||||
mediaListViewService,
|
||||
backOfficeSecurityAccessor,
|
||||
mapper,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IMediaCollectionPresentationFactory>())
|
||||
{
|
||||
}
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public ByKeyMediaCollectionController(
|
||||
IMediaListViewService mediaListViewService,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -7,6 +7,7 @@ using Umbraco.Cms.Api.Management.ViewModels.Media;
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Media;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[Obsolete("No longer used. Scheduled for removal in Umbraco 18.")]
|
||||
public class ConfigurationMediaController : MediaControllerBase
|
||||
{
|
||||
private readonly IConfigurationPresentationFactory _configurationPresentationFactory;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -25,13 +25,13 @@ public class ItemMediaItemController : MediaItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MediaItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<MediaItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<MediaItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IMediaEntitySlim> media = _entityService
|
||||
@@ -39,6 +39,6 @@ public class ItemMediaItemController : MediaItemControllerBase
|
||||
.OfType<IMediaEntitySlim>();
|
||||
|
||||
IEnumerable<MediaItemResponseModel> responseModels = media.Select(_mediaPresentationFactory.CreateItemResponseModel);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -23,24 +23,13 @@ public class SearchMediaItemController : MediaItemControllerBase
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
=> await SearchFromParent(cancellationToken, query, skip, take, null);
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
[ProducesResponseType(typeof(PagedModel<MediaItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
|
||||
=> await SearchFromParentWithAllowedTypes(cancellationToken, query, skip, take, parentId);
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
public async Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
|
||||
=> await SearchFromParentWithAllowedTypes(cancellationToken, query, null, skip, take, parentId);
|
||||
public Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
|
||||
=> SearchFromParentWithAllowedTypes(cancellationToken, query, null, skip, take, parentId);
|
||||
|
||||
[HttpGet("search")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedModel<MediaItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, bool? trashed = null, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
|
||||
public Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, bool? trashed = null, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
|
||||
{
|
||||
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Media, query, parentId, allowedMediaTypes, trashed, skip, take);
|
||||
var result = new PagedModel<MediaItemResponseModel>
|
||||
@@ -49,6 +38,6 @@ public class SearchMediaItemController : MediaItemControllerBase
|
||||
Total = searchResult.Total,
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<IActionResult>(Ok(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -25,10 +25,10 @@ public class MediaUrlController : MediaControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpGet("urls")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MediaUrlInfoResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> GetUrls([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
public Task<IActionResult> GetUrls([FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
IEnumerable<IMedia> items = _mediaService.GetByIds(ids);
|
||||
|
||||
return await Task.FromResult(Ok(_mediaUrlFactory.CreateUrlSets(items)));
|
||||
return Task.FromResult<IActionResult>(Ok(_mediaUrlFactory.CreateUrlSets(items)));
|
||||
}
|
||||
}
|
||||
|
||||
-9
@@ -23,15 +23,6 @@ public class AllowedChildrenMediaTypeController : MediaTypeControllerBase
|
||||
_umbracoMapper = umbracoMapper;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Use the non obsoleted method instead. Scheduled for removal in Umbraco 16.")]
|
||||
public async Task<IActionResult> AllowedChildrenByKey(
|
||||
CancellationToken cancellationToken,
|
||||
Guid id,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
=> await AllowedChildrenByKey(cancellationToken, id, null, skip, take);
|
||||
|
||||
[HttpGet("{id:guid}/allowed-children")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<AllowedMediaType>), StatusCodes.Status200OK)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.MediaType;
|
||||
@@ -34,6 +34,6 @@ public class ByKeyMediaTypeController : MediaTypeControllerBase
|
||||
}
|
||||
|
||||
MediaTypeResponseModel model = _umbracoMapper.Map<MediaTypeResponseModel>(mediaType)!;
|
||||
return await Task.FromResult(Ok(model));
|
||||
return Ok(model);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.MediaType.Item;
|
||||
@@ -23,17 +23,17 @@ public class ItemMediaTypeItemController : MediaTypeItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MediaTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<MediaTypeItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<MediaTypeItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IMediaType> mediaTypes = _mediaTypeService.GetMany(ids);
|
||||
List<MediaTypeItemResponseModel> responseModels = _mapper.MapEnumerable<IMediaType, MediaTypeItemResponseModel>(mediaTypes);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.MediaType.Item;
|
||||
@@ -27,12 +27,12 @@ public class SearchMediaTypeItemController : MediaTypeItemControllerBase
|
||||
[HttpGet("search")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedModel<MediaTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
public Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
{
|
||||
PagedModel<IEntitySlim> searchResult = _entitySearchService.Search(UmbracoObjectTypes.MediaType, query, skip, take);
|
||||
if (searchResult.Items.Any() is false)
|
||||
{
|
||||
return await Task.FromResult(Ok(new PagedModel<MediaTypeItemResponseModel> { Total = searchResult.Total }));
|
||||
return Task.FromResult<IActionResult>(Ok(new PagedModel<MediaTypeItemResponseModel> { Total = searchResult.Total }));
|
||||
}
|
||||
|
||||
IEnumerable<IMediaType> mediaTypes = _mediaTypeService.GetMany(searchResult.Items.Select(item => item.Key).ToArray().EmptyNull());
|
||||
@@ -42,6 +42,6 @@ public class SearchMediaTypeItemController : MediaTypeItemControllerBase
|
||||
Total = searchResult.Total
|
||||
};
|
||||
|
||||
return Ok(result);
|
||||
return Task.FromResult<IActionResult>(Ok(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -25,13 +25,13 @@ public class ItemMemberItemController : MemberItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MemberItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<MemberItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<MemberItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IMemberEntitySlim> members = _entityService
|
||||
@@ -39,6 +39,6 @@ public class ItemMemberItemController : MemberItemControllerBase
|
||||
.OfType<IMemberEntitySlim>();
|
||||
|
||||
IEnumerable<MemberItemResponseModel> responseModels = members.Select(_memberPresentationFactory.CreateItemResponseModel);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-8
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -21,15 +21,10 @@ public class SearchMemberItemController : MemberItemControllerBase
|
||||
_memberPresentationFactory = memberPresentationFactory;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
|
||||
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
=> await SearchWithAllowedTypes(cancellationToken, query, skip, take);
|
||||
|
||||
[HttpGet("search")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedModel<MemberItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable<Guid>? allowedMemberTypes = null)
|
||||
public Task<IActionResult> SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable<Guid>? allowedMemberTypes = null)
|
||||
{
|
||||
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, skip, take);
|
||||
var result = new PagedModel<MemberItemResponseModel>
|
||||
@@ -38,6 +33,6 @@ public class SearchMemberItemController : MemberItemControllerBase
|
||||
Total = searchResult.Total
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<IActionResult>(Ok(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
@@ -36,6 +36,6 @@ public class AllMemberGroupController : MemberGroupControllerBase
|
||||
Items = _mapper.MapEnumerable<IMemberGroup, MemberGroupResponseModel>(memberGroups.Skip(skip).Take(take)),
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Ok(viewModel);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -25,17 +25,17 @@ public class ItemMemberGroupItemController : MemberGroupItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MemberGroupItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<MemberGroupItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<MemberGroupItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IEntitySlim> memberGroups = _entityService.GetAll(UmbracoObjectTypes.MemberGroup, ids.ToArray());
|
||||
List<MemberGroupItemResponseModel> responseModel = _mapper.MapEnumerable<IEntitySlim, MemberGroupItemResponseModel>(memberGroups);
|
||||
return Ok(responseModel);
|
||||
return Task.FromResult<IActionResult>(Ok(responseModel));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,17 +23,17 @@ public class ItemMemberTypeItemController : MemberTypeItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MemberTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<MemberTypeItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<MemberTypeItemResponseModel>()));
|
||||
}
|
||||
|
||||
IEnumerable<IMemberType> memberTypes = _memberTypeService.GetMany(ids);
|
||||
List<MemberTypeItemResponseModel> responseModels = _mapper.MapEnumerable<IMemberType, MemberTypeItemResponseModel>(memberTypes);
|
||||
return Ok(responseModels);
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.MemberType.Item;
|
||||
@@ -26,12 +26,12 @@ public class SearchMemberTypeItemController : MemberTypeItemControllerBase
|
||||
[HttpGet("search")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedModel<MemberTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
public Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
|
||||
{
|
||||
PagedModel<IEntitySlim> searchResult = _entitySearchService.Search(UmbracoObjectTypes.MemberType, query, skip, take);
|
||||
if (searchResult.Items.Any() is false)
|
||||
{
|
||||
return await Task.FromResult(Ok(new PagedModel<MemberTypeItemResponseModel> { Total = searchResult.Total }));
|
||||
return Task.FromResult<IActionResult>(Ok(new PagedModel<MemberTypeItemResponseModel> { Total = searchResult.Total }));
|
||||
}
|
||||
|
||||
IEnumerable<IMemberType> memberTypes = _memberTypeService.GetMany(searchResult.Items.Select(item => item.Key).ToArray());
|
||||
@@ -41,6 +41,6 @@ public class SearchMemberTypeItemController : MemberTypeItemControllerBase
|
||||
Total = searchResult.Total
|
||||
};
|
||||
|
||||
return Ok(result);
|
||||
return Task.FromResult<IActionResult>(Ok(result));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-24
@@ -19,7 +19,6 @@ public class BuildModelsBuilderController : ModelsBuilderControllerBase
|
||||
private readonly ModelsGenerationError _mbErrors;
|
||||
private readonly IModelsGenerator _modelGenerator;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public BuildModelsBuilderController(
|
||||
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
|
||||
ModelsGenerationError mbErrors,
|
||||
@@ -32,31 +31,11 @@ public class BuildModelsBuilderController : ModelsBuilderControllerBase
|
||||
modelsBuilderSettings.OnChange(x => _modelsBuilderSettings = x);
|
||||
}
|
||||
|
||||
[Obsolete("Please use the constructor that accepts IModelsGenerator only. Will be removed in V16.")]
|
||||
public BuildModelsBuilderController(
|
||||
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
|
||||
ModelsGenerationError mbErrors,
|
||||
ModelsGenerator modelGenerator)
|
||||
: this(modelsBuilderSettings, mbErrors, (IModelsGenerator)modelGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
// this constructor is required for the DI, otherwise it'll throw an "Ambiguous Constructor" errors at boot time.
|
||||
[Obsolete("Please use the constructor that accepts IModelsGenerator only. Will be removed in V16.")]
|
||||
public BuildModelsBuilderController(
|
||||
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
|
||||
ModelsGenerationError mbErrors,
|
||||
IModelsGenerator modelGenerator,
|
||||
ModelsGenerator notUsed)
|
||||
: this(modelsBuilderSettings, mbErrors, modelGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpPost("build")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status428PreconditionRequired)]
|
||||
[MapToApiVersion("1.0")]
|
||||
public async Task<IActionResult> BuildModels(CancellationToken cancellationToken)
|
||||
public Task<IActionResult> BuildModels(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -70,7 +49,7 @@ public class BuildModelsBuilderController : ModelsBuilderControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return new ObjectResult(problemDetailsModel) { StatusCode = StatusCodes.Status428PreconditionRequired };
|
||||
return Task.FromResult<IActionResult>(new ObjectResult(problemDetailsModel) { StatusCode = StatusCodes.Status428PreconditionRequired });
|
||||
}
|
||||
|
||||
_modelGenerator.GenerateModels();
|
||||
@@ -81,6 +60,6 @@ public class BuildModelsBuilderController : ModelsBuilderControllerBase
|
||||
_mbErrors.Report("Failed to build models.", e);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
return Task.FromResult<IActionResult>(Ok());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -16,6 +16,6 @@ public class GetModelsBuilderController : ModelsBuilderControllerBase
|
||||
[HttpGet("dashboard")]
|
||||
[ProducesResponseType(typeof(ModelsBuilderResponseModel), StatusCodes.Status200OK)]
|
||||
[MapToApiVersion("1.0")]
|
||||
public async Task<ActionResult<ModelsBuilderResponseModel>> GetDashboard(CancellationToken cancellationToken)
|
||||
=> await Task.FromResult(Ok(_modelsBuilderPresentationFactory.Create()));
|
||||
public Task<ActionResult<ModelsBuilderResponseModel>> GetDashboard(CancellationToken cancellationToken)
|
||||
=> Task.FromResult<ActionResult<ModelsBuilderResponseModel>>(Ok(_modelsBuilderPresentationFactory.Create()));
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -18,7 +18,7 @@ public class StatusModelsBuilderController : ModelsBuilderControllerBase
|
||||
[HttpGet("status")]
|
||||
[ProducesResponseType(typeof(OutOfDateStatusResponseModel), StatusCodes.Status200OK)]
|
||||
[MapToApiVersion("1.0")]
|
||||
public async Task<ActionResult<OutOfDateStatusResponseModel>> GetModelsOutOfDateStatus(CancellationToken cancellationToken)
|
||||
public Task<ActionResult<OutOfDateStatusResponseModel>> GetModelsOutOfDateStatus(CancellationToken cancellationToken)
|
||||
{
|
||||
OutOfDateStatusResponseModel status = _outOfDateModelsStatus.IsEnabled
|
||||
? _outOfDateModelsStatus.IsOutOfDate
|
||||
@@ -26,6 +26,6 @@ public class StatusModelsBuilderController : ModelsBuilderControllerBase
|
||||
: new OutOfDateStatusResponseModel { Status = OutOfDateType.Current }
|
||||
: new OutOfDateStatusResponseModel { Status = OutOfDateType.Unknown };
|
||||
|
||||
return await Task.FromResult(Ok(status));
|
||||
return Task.FromResult<ActionResult<OutOfDateStatusResponseModel>>(Ok(status));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
@@ -17,11 +17,11 @@ public class AllowedObjectTypesController : ObjectTypesControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<ObjectTypeResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Allowed(CancellationToken cancellationToken, int skip = 0, int take = 100)
|
||||
public Task<IActionResult> Allowed(CancellationToken cancellationToken, int skip = 0, int take = 100)
|
||||
{
|
||||
ObjectTypeResponseModel[] objectTypes = _objectTypePresentationFactory.Create().ToArray();
|
||||
|
||||
return await Task.FromResult(Ok(new PagedViewModel<ObjectTypeResponseModel>
|
||||
return Task.FromResult<IActionResult>(Ok(new PagedViewModel<ObjectTypeResponseModel>
|
||||
{
|
||||
Total = objectTypes.Length,
|
||||
Items = objectTypes.Skip(skip).Take(take),
|
||||
|
||||
+1
-1
@@ -44,6 +44,6 @@ public class AllCreatedPackageController : CreatedPackageControllerBase
|
||||
Items = _umbracoMapper.MapEnumerable<PackageDefinition, PackageDefinitionResponseModel>(createdPackages.Items)
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Ok(viewModel);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Extensions;
|
||||
@@ -18,17 +18,17 @@ public class ItemPartialViewItemController : PartialViewItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<PartialViewItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "path")] HashSet<string> paths)
|
||||
{
|
||||
if (paths.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<PartialViewItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<PartialViewItemResponseModel>()));
|
||||
}
|
||||
|
||||
paths = paths.Select(path => path.VirtualPathToSystemPath()).ToHashSet();
|
||||
IEnumerable<PartialViewItemResponseModel> responseModels = _fileItemPresentationFactory.CreatePartialViewItemResponseModels(paths);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.PublishedCache;
|
||||
|
||||
[Obsolete("This controller no longer serves a purpose")]
|
||||
[ApiVersion("1.0")]
|
||||
public class CollectPublishedCacheController : PublishedCacheControllerBase
|
||||
{
|
||||
[HttpPost("collect")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(StatusCodes.Status501NotImplemented)]
|
||||
public async Task<IActionResult> Collect(CancellationToken cancellationToken)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status501NotImplemented);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class RebuildPublishedCacheController : PublishedCacheControllerBase
|
||||
var problemDetails = new ProblemDetails
|
||||
{
|
||||
Title = "Database cache cannot be rebuilt",
|
||||
Detail = $"The database cache is in the process of rebuilding.",
|
||||
Detail = "The database cache is in the process of rebuilding.",
|
||||
Status = StatusCodes.Status400BadRequest,
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
@@ -16,10 +16,9 @@ public class ReloadPublishedCacheController : PublishedCacheControllerBase
|
||||
[HttpPost("reload")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Reload(CancellationToken cancellationToken)
|
||||
public Task<IActionResult> Reload(CancellationToken cancellationToken)
|
||||
{
|
||||
_distributedCache.RefreshAllPublishedSnapshot();
|
||||
return await Task.FromResult(Ok());
|
||||
return Task.FromResult<IActionResult>(Ok());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.PublishedCache;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
[Obsolete("This no longer relevant since snapshots are no longer used")]
|
||||
public class StatusPublishedCacheController : PublishedCacheControllerBase
|
||||
{
|
||||
[HttpGet("status")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(StatusCodes.Status501NotImplemented)]
|
||||
public async Task<ActionResult<string>> Status(CancellationToken cancellationToken)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status501NotImplemented);
|
||||
}
|
||||
}
|
||||
@@ -23,17 +23,18 @@ public abstract class RecycleBinControllerBase<TItem> : ContentControllerBase
|
||||
|
||||
protected abstract Guid RecycleBinRootKey { get; }
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<TItem>>> GetRoot(int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<TItem>>> GetRoot(int skip, int take)
|
||||
{
|
||||
IEntitySlim[] rootEntities = GetPagedRootEntities(skip, take, out var totalItems);
|
||||
|
||||
TItem[] treeItemViewModels = MapRecycleBinViewModels(null, rootEntities);
|
||||
|
||||
PagedViewModel<TItem> result = PagedViewModel(treeItemViewModels, totalItems);
|
||||
return await Task.FromResult(Ok(result));
|
||||
|
||||
return Task.FromResult<ActionResult<PagedViewModel<TItem>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<TItem>>> GetChildren(Guid parentKey, int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<TItem>>> GetChildren(Guid parentKey, int skip, int take)
|
||||
{
|
||||
IEntitySlim[] children = GetPagedChildEntities(parentKey, skip, take, out var totalItems);
|
||||
|
||||
@@ -41,7 +42,7 @@ public abstract class RecycleBinControllerBase<TItem> : ContentControllerBase
|
||||
|
||||
PagedViewModel<TItem> result = PagedViewModel(treeItemViewModels, totalItems);
|
||||
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<TItem>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected virtual TItem MapRecycleBinViewModel(Guid? parentKey, IEntitySlim entity)
|
||||
|
||||
+2
-2
@@ -18,9 +18,9 @@ public class DeleteByKeyRedirectUrlManagementController : RedirectUrlManagementC
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpDelete("{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteByKey(CancellationToken cancellationToken, Guid id)
|
||||
public Task<IActionResult> DeleteByKey(CancellationToken cancellationToken, Guid id)
|
||||
{
|
||||
_redirectUrlService.Delete(id);
|
||||
return Ok();
|
||||
return Task.FromResult<IActionResult>(Ok());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ public class GetAllRedirectUrlManagementController : RedirectUrlManagementContro
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(PagedViewModel<RedirectUrlResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<RedirectUrlResponseModel>>> GetAll(
|
||||
public Task<ActionResult<PagedViewModel<RedirectUrlResponseModel>>> GetAll(
|
||||
CancellationToken cancellationToken,
|
||||
string? filter,
|
||||
int skip = 0,
|
||||
@@ -39,6 +39,6 @@ public class GetAllRedirectUrlManagementController : RedirectUrlManagementContro
|
||||
: _redirectUrlService.SearchRedirectUrls(filter, skip, take, out total);
|
||||
|
||||
IEnumerable<RedirectUrlResponseModel> redirectViewModels = _redirectUrlPresentationFactory.CreateMany(redirects);
|
||||
return new PagedViewModel<RedirectUrlResponseModel> { Items = redirectViewModels, Total = total };
|
||||
return Task.FromResult<ActionResult<PagedViewModel<RedirectUrlResponseModel>>>(new PagedViewModel<RedirectUrlResponseModel> { Items = redirectViewModels, Total = total });
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -43,16 +43,15 @@ public class ByRelationTypeKeyRelationController : RelationControllerBase
|
||||
|
||||
if (relationsAttempt.Success is false)
|
||||
{
|
||||
return await Task.FromResult(RelationOperationStatusResult(relationsAttempt.Status));
|
||||
return RelationOperationStatusResult(relationsAttempt.Status);
|
||||
}
|
||||
|
||||
IEnumerable<RelationResponseModel> mappedRelations = relationsAttempt.Result.Items.Select(_relationPresentationFactory.Create);
|
||||
|
||||
return await Task.FromResult(Ok(new PagedViewModel<RelationResponseModel>
|
||||
return Ok(new PagedViewModel<RelationResponseModel>
|
||||
{
|
||||
Total = relationsAttempt.Result.Total,
|
||||
Items = mappedRelations,
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.RelationType;
|
||||
@@ -24,16 +24,16 @@ public class ByKeyRelationTypeController : RelationTypeControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(RelationTypeResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> ByKey(CancellationToken cancellationToken, Guid id)
|
||||
public Task<IActionResult> ByKey(CancellationToken cancellationToken, Guid id)
|
||||
{
|
||||
IRelationType? relationType = _relationService.GetRelationTypeById(id);
|
||||
if (relationType is null)
|
||||
{
|
||||
return RelationTypeNotFound();
|
||||
return Task.FromResult(RelationTypeNotFound());
|
||||
}
|
||||
|
||||
RelationTypeResponseModel mappedRelationType = _mapper.Map<RelationTypeResponseModel>(relationType)!;
|
||||
|
||||
return await Task.FromResult(Ok(mappedRelationType));
|
||||
return Task.FromResult<IActionResult>(Ok(mappedRelationType));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.RelationType.Item;
|
||||
@@ -23,13 +23,13 @@ public class ItemRelationTypeItemController : RelationTypeItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<RelationTypeItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "id")] HashSet<Guid> ids)
|
||||
{
|
||||
if (ids.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<RelationTypeItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<RelationTypeItemResponseModel>()));
|
||||
}
|
||||
|
||||
// relation service does not allow fetching a collection of relation types by their ids; instead it relies
|
||||
@@ -40,6 +40,6 @@ public class ItemRelationTypeItemController : RelationTypeItemControllerBase
|
||||
|
||||
List<RelationTypeItemResponseModel> responseModels = _mapper.MapEnumerable<IRelationType, RelationTypeItemResponseModel>(relationTypes);
|
||||
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Extensions;
|
||||
@@ -18,17 +18,17 @@ public class ItemScriptItemController : ScriptItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<ScriptItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "path")] HashSet<string> paths)
|
||||
{
|
||||
if (paths.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<ScriptItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<ScriptItemResponseModel>()));
|
||||
}
|
||||
|
||||
paths = paths.Select(path => path.VirtualPathToSystemPath()).ToHashSet();
|
||||
IEnumerable<ScriptItemResponseModel> responseModels = _fileItemPresentationFactory.CreateScriptItemResponseModels(paths);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Examine;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -22,7 +22,7 @@ public class AllSearcherController : SearcherControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<SearcherResponse>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<SearcherResponse>>> All(
|
||||
public Task<ActionResult<PagedViewModel<SearcherResponse>>> All(
|
||||
CancellationToken cancellationToken,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
@@ -37,6 +37,6 @@ public class AllSearcherController : SearcherControllerBase
|
||||
Total = searchers.Count,
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<SearcherResponse>>>(Ok(viewModel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Examine;
|
||||
using Examine.Lucene.Search;
|
||||
using Examine.Search;
|
||||
@@ -23,7 +23,7 @@ public class QuerySearcherController : SearcherControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<SearchResultResponseModel>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<PagedViewModel<SearchResultResponseModel>>> Query(
|
||||
public Task<ActionResult<PagedViewModel<SearchResultResponseModel>>> Query(
|
||||
CancellationToken cancellationToken,
|
||||
string searcherName,
|
||||
string? term,
|
||||
@@ -34,7 +34,7 @@ public class QuerySearcherController : SearcherControllerBase
|
||||
|
||||
if (term.IsNullOrWhiteSpace())
|
||||
{
|
||||
return new PagedViewModel<SearchResultResponseModel>();
|
||||
return Task.FromResult<ActionResult<PagedViewModel<SearchResultResponseModel>>>(new PagedViewModel<SearchResultResponseModel>());
|
||||
}
|
||||
|
||||
if (!_examineManagerService.TryFindSearcher(searcherName, out ISearcher searcher))
|
||||
@@ -47,7 +47,7 @@ public class QuerySearcherController : SearcherControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return NotFound(invalidModelProblem);
|
||||
return Task.FromResult<ActionResult<PagedViewModel<SearchResultResponseModel>>>(NotFound(invalidModelProblem));
|
||||
}
|
||||
|
||||
ISearchResults results;
|
||||
@@ -71,10 +71,10 @@ public class QuerySearcherController : SearcherControllerBase
|
||||
Type = "Error",
|
||||
};
|
||||
|
||||
return BadRequest(invalidModelProblem);
|
||||
return Task.FromResult<ActionResult<PagedViewModel<SearchResultResponseModel>>>(BadRequest(invalidModelProblem));
|
||||
}
|
||||
|
||||
return await Task.FromResult(new PagedViewModel<SearchResultResponseModel>
|
||||
return Task.FromResult<ActionResult<PagedViewModel<SearchResultResponseModel>>>(new PagedViewModel<SearchResultResponseModel>
|
||||
{
|
||||
Total = results.TotalItemCount,
|
||||
Items = results.Select(x => new SearchResultResponseModel
|
||||
|
||||
@@ -492,7 +492,7 @@ public class BackOfficeController : SecurityControllerBase
|
||||
return new ChallengeResult(provider, properties);
|
||||
}
|
||||
|
||||
private async Task<IActionResult> SignInBackOfficeUser(ClaimsPrincipal backOfficePrincipal, OpenIddictRequest request)
|
||||
private Task<IActionResult> SignInBackOfficeUser(ClaimsPrincipal backOfficePrincipal, OpenIddictRequest request)
|
||||
{
|
||||
Claim[] backOfficeClaims = backOfficePrincipal.Claims.ToArray();
|
||||
foreach (Claim backOfficeClaim in backOfficeClaims)
|
||||
@@ -506,7 +506,7 @@ public class BackOfficeController : SecurityControllerBase
|
||||
backOfficePrincipal.SetScopes(OpenIddictConstants.Scopes.OfflineAccess);
|
||||
}
|
||||
|
||||
return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, backOfficePrincipal);
|
||||
return Task.FromResult<IActionResult>(new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, backOfficePrincipal));
|
||||
}
|
||||
|
||||
private async Task<IActionResult> SignInBackOfficeUser(BackOfficeIdentityUser backOfficeUser, OpenIddictRequest request)
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -20,13 +20,13 @@ public class ConfigurationSecurityController : SecurityControllerBase
|
||||
[HttpGet("configuration")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(SecurityConfigurationResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Configuration(CancellationToken cancellationToken)
|
||||
public Task<IActionResult> Configuration(CancellationToken cancellationToken)
|
||||
{
|
||||
var viewModel = new SecurityConfigurationResponseModel
|
||||
{
|
||||
PasswordConfiguration = _passwordConfigurationPresentationFactory.CreatePasswordConfigurationResponseModel(),
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(viewModel));
|
||||
return Task.FromResult<IActionResult>(Ok(viewModel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Api.Management.Security;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Server;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Server;
|
||||
|
||||
@@ -18,19 +16,6 @@ public class ConfigurationServerController : ServerControllerBase
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IBackOfficeExternalLoginProviders _externalLoginProviders;
|
||||
|
||||
[Obsolete("Use the constructor that accepts all arguments. Will be removed in V16.")]
|
||||
public ConfigurationServerController(IOptions<SecuritySettings> securitySettings)
|
||||
: this(securitySettings, StaticServiceProvider.Instance.GetRequiredService<IOptions<GlobalSettings>>())
|
||||
{
|
||||
}
|
||||
|
||||
[Obsolete("Use the constructor that accepts all arguments. Will be removed in V16.")]
|
||||
public ConfigurationServerController(IOptions<SecuritySettings> securitySettings, IOptions<GlobalSettings> globalSettings)
|
||||
: this(securitySettings, globalSettings, StaticServiceProvider.Instance.GetRequiredService<IBackOfficeExternalLoginProviders>())
|
||||
{
|
||||
}
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public ConfigurationServerController(IOptions<SecuritySettings> securitySettings, IOptions<GlobalSettings> globalSettings, IBackOfficeExternalLoginProviders externalLoginProviders)
|
||||
{
|
||||
_securitySettings = securitySettings.Value;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -19,6 +19,6 @@ public class StatusServerController : ServerControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(ServerStatusResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<ServerStatusResponseModel>> Get(CancellationToken cancellationToken) =>
|
||||
await Task.FromResult(new ServerStatusResponseModel { ServerStatus = _runtimeState.Level });
|
||||
public Task<ActionResult<ServerStatusResponseModel>> Get(CancellationToken cancellationToken)
|
||||
=> Task.FromResult<ActionResult<ServerStatusResponseModel>>(new ServerStatusResponseModel { ServerStatus = _runtimeState.Level });
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Extensions;
|
||||
@@ -18,17 +18,17 @@ public class ItemStaticFileItemController : StaticFileItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<StaticFileItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "path")] HashSet<string> paths)
|
||||
{
|
||||
if (paths.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<StaticFileItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<StaticFileItemResponseModel>()));
|
||||
}
|
||||
|
||||
paths = paths.Select(path => path.VirtualPathToSystemPath()).ToHashSet();
|
||||
IEnumerable<StaticFileItemResponseModel> responseModels = _fileItemPresentationFactory.CreateStaticFileItemResponseModels(paths);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Extensions;
|
||||
@@ -18,17 +18,17 @@ public class ItemStylesheetItemController : StylesheetItemControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<StylesheetItemResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Item(
|
||||
public Task<IActionResult> Item(
|
||||
CancellationToken cancellationToken,
|
||||
[FromQuery(Name = "path")] HashSet<string> paths)
|
||||
{
|
||||
if (paths.Count is 0)
|
||||
{
|
||||
return Ok(Enumerable.Empty<StylesheetItemResponseModel>());
|
||||
return Task.FromResult<IActionResult>(Ok(Enumerable.Empty<StylesheetItemResponseModel>()));
|
||||
}
|
||||
|
||||
paths = paths.Select(path => path.VirtualPathToSystemPath()).ToHashSet();
|
||||
IEnumerable<StylesheetItemResponseModel> responseModels = _fileItemPresentationFactory.CreateStylesheetItemResponseModels(paths);
|
||||
return await Task.FromResult(Ok(responseModels));
|
||||
return Task.FromResult<IActionResult>(Ok(responseModels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
@@ -42,6 +42,6 @@ public class ByQueryTagController : TagControllerBase
|
||||
Total = responseModels.Count,
|
||||
};
|
||||
|
||||
return await Task.FromResult(Ok(pagedViewModel));
|
||||
return Ok(pagedViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ public class AllTelemetryController : TelemetryControllerBase
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<TelemetryResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<PagedViewModel<TelemetryResponseModel>> GetAll(
|
||||
public Task<PagedViewModel<TelemetryResponseModel>> GetAll(
|
||||
CancellationToken cancellationToken,
|
||||
int skip = 0,
|
||||
int take = 100)
|
||||
{
|
||||
TelemetryLevel[] levels = Enum.GetValues<TelemetryLevel>();
|
||||
return await Task.FromResult(new PagedViewModel<TelemetryResponseModel>
|
||||
return Task.FromResult(new PagedViewModel<TelemetryResponseModel>
|
||||
{
|
||||
Total = levels.Length,
|
||||
Items = levels.Skip(skip).Take(take).Select(level => new TelemetryResponseModel { TelemetryLevel = level }),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
@@ -16,6 +16,6 @@ public class GetTelemetryController : TelemetryControllerBase
|
||||
[HttpGet("level")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(TelemetryResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<TelemetryRepresentationBase> Get(CancellationToken cancellationToken)
|
||||
=> await Task.FromResult(new TelemetryResponseModel { TelemetryLevel = _metricsConsentService.GetConsentLevel() });
|
||||
public Task<TelemetryRepresentationBase> Get(CancellationToken cancellationToken)
|
||||
=> Task.FromResult<TelemetryRepresentationBase>(new TelemetryResponseModel { TelemetryLevel = _metricsConsentService.GetConsentLevel() });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
@@ -34,6 +34,6 @@ public class SetTelemetryController : TelemetryControllerBase
|
||||
}
|
||||
|
||||
await _metricsConsentService.SetConsentLevelAsync(telemetryRepresentationBase.TelemetryLevel);
|
||||
return await Task.FromResult(Ok());
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ public class ExecuteTemplateQueryController : TemplateQueryControllerBase
|
||||
[HttpPost("execute")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(TemplateQueryResultResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<TemplateQueryResultResponseModel>> Execute(
|
||||
public Task<ActionResult<TemplateQueryResultResponseModel>> Execute(
|
||||
CancellationToken cancellationToken,
|
||||
TemplateQueryExecuteModel query)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public class ExecuteTemplateQueryController : TemplateQueryControllerBase
|
||||
.GetMany(results.Select(content => content.ContentType.Key).Distinct())
|
||||
.ToDictionary(contentType => contentType.Key, contentType => contentType.Icon);
|
||||
|
||||
return await Task.FromResult(Ok(new TemplateQueryResultResponseModel
|
||||
return Task.FromResult<ActionResult<TemplateQueryResultResponseModel>>(Ok(new TemplateQueryResultResponseModel
|
||||
{
|
||||
QueryExpression = queryExpression.ToString(),
|
||||
ResultCount = results.Count,
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Template.Query;
|
||||
@@ -17,7 +17,7 @@ public class SettingsTemplateQueryController : TemplateQueryControllerBase
|
||||
[HttpGet("settings")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(TemplateQuerySettingsResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<TemplateQuerySettingsResponseModel>> Settings(CancellationToken cancellationToken)
|
||||
public Task<ActionResult<TemplateQuerySettingsResponseModel>> Settings(CancellationToken cancellationToken)
|
||||
{
|
||||
var contentTypeAliases = _contentTypeService
|
||||
.GetAll()
|
||||
@@ -29,7 +29,7 @@ public class SettingsTemplateQueryController : TemplateQueryControllerBase
|
||||
|
||||
IEnumerable<TemplateQueryOperatorViewModel> operators = GetOperators();
|
||||
|
||||
return await Task.FromResult(Ok(new TemplateQuerySettingsResponseModel
|
||||
return Task.FromResult<ActionResult<TemplateQuerySettingsResponseModel>>(Ok(new TemplateQuerySettingsResponseModel
|
||||
{
|
||||
DocumentTypeAliases = contentTypeAliases,
|
||||
Properties = properties,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
using Umbraco.Cms.Api.Management.ViewModels;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
||||
@@ -22,24 +22,26 @@ public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerB
|
||||
|
||||
protected virtual Ordering ItemOrdering => Ordering.By(nameof(Infrastructure.Persistence.Dtos.NodeDto.Text));
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<TItem>>> GetRoot(int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<TItem>>> GetRoot(int skip, int take)
|
||||
{
|
||||
IEntitySlim[] rootEntities = GetPagedRootEntities(skip, take, out var totalItems);
|
||||
|
||||
TItem[] treeItemViewModels = MapTreeItemViewModels(null, rootEntities);
|
||||
|
||||
PagedViewModel<TItem> result = PagedViewModel(treeItemViewModels, totalItems);
|
||||
return await Task.FromResult(Ok(result));
|
||||
|
||||
return Task.FromResult<ActionResult<PagedViewModel<TItem>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<TItem>>> GetChildren(Guid parentId, int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<TItem>>> GetChildren(Guid parentId, int skip, int take)
|
||||
{
|
||||
IEntitySlim[] children = GetPagedChildEntities(parentId, skip, take, out var totalItems);
|
||||
|
||||
TItem[] treeItemViewModels = MapTreeItemViewModels(parentId, children);
|
||||
|
||||
PagedViewModel<TItem> result = PagedViewModel(treeItemViewModels, totalItems);
|
||||
return await Task.FromResult(Ok(result));
|
||||
|
||||
return Task.FromResult<ActionResult<PagedViewModel<TItem>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected virtual async Task<ActionResult<IEnumerable<TItem>>> GetAncestors(Guid descendantKey, bool includeSelf = true)
|
||||
@@ -60,13 +62,13 @@ public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerB
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
protected virtual async Task<IEntitySlim[]> GetAncestorEntitiesAsync(Guid descendantKey, bool includeSelf)
|
||||
protected virtual Task<IEntitySlim[]> GetAncestorEntitiesAsync(Guid descendantKey, bool includeSelf)
|
||||
{
|
||||
IEntitySlim? entity = EntityService.Get(descendantKey, ItemObjectType);
|
||||
if (entity is null)
|
||||
{
|
||||
// not much else we can do here but return nothing
|
||||
return await Task.FromResult(Array.Empty<IEntitySlim>());
|
||||
return Task.FromResult(Array.Empty<IEntitySlim>());
|
||||
}
|
||||
|
||||
var ancestorIds = entity.AncestorIds();
|
||||
@@ -76,7 +78,7 @@ public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerB
|
||||
: Array.Empty<IEntitySlim>();
|
||||
ancestors = ancestors.Union(includeSelf ? new[] { entity } : Array.Empty<IEntitySlim>());
|
||||
|
||||
return ancestors.OrderBy(item => item.Level).ToArray();
|
||||
return Task.FromResult(ancestors.OrderBy(item => item.Level).ToArray());
|
||||
}
|
||||
|
||||
protected virtual IEntitySlim[] GetPagedRootEntities(int skip, int take, out long totalItems)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
using Umbraco.Cms.Api.Management.Extensions;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.FileSystem;
|
||||
@@ -12,28 +12,28 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase
|
||||
{
|
||||
protected abstract IFileSystem FileSystem { get; }
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>> GetRoot(int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>> GetRoot(int skip, int take)
|
||||
{
|
||||
FileSystemTreeItemPresentationModel[] viewModels = GetPathViewModels(string.Empty, skip, take, out var totalItems);
|
||||
|
||||
PagedViewModel<FileSystemTreeItemPresentationModel> result = PagedViewModel(viewModels, totalItems);
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>> GetChildren(string path, int skip, int take)
|
||||
protected Task<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>> GetChildren(string path, int skip, int take)
|
||||
{
|
||||
FileSystemTreeItemPresentationModel[] viewModels = GetPathViewModels(path, skip, take, out var totalItems);
|
||||
|
||||
PagedViewModel<FileSystemTreeItemPresentationModel> result = PagedViewModel(viewModels, totalItems);
|
||||
return await Task.FromResult(Ok(result));
|
||||
return Task.FromResult<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>>(Ok(result));
|
||||
}
|
||||
|
||||
protected virtual async Task<ActionResult<IEnumerable<FileSystemTreeItemPresentationModel>>> GetAncestors(string path, bool includeSelf = true)
|
||||
protected virtual Task<ActionResult<IEnumerable<FileSystemTreeItemPresentationModel>>> GetAncestors(string path, bool includeSelf = true)
|
||||
{
|
||||
path = path.VirtualPathToSystemPath();
|
||||
FileSystemTreeItemPresentationModel[] models = GetAncestorModels(path, includeSelf);
|
||||
|
||||
return await Task.FromResult(Ok(models));
|
||||
return Task.FromResult<ActionResult<IEnumerable<FileSystemTreeItemPresentationModel>>>(Ok(models));
|
||||
}
|
||||
|
||||
protected virtual FileSystemTreeItemPresentationModel[] GetAncestorModels(string path, bool includeSelf)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.Entities;
|
||||
@@ -63,14 +63,14 @@ public abstract class FolderTreeControllerBase<TItem> : NamedEntityTreeControlle
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
protected override async Task<IEntitySlim[]> GetAncestorEntitiesAsync(Guid descendantKey, bool includeSelf = true)
|
||||
protected override Task<IEntitySlim[]> GetAncestorEntitiesAsync(Guid descendantKey, bool includeSelf = true)
|
||||
{
|
||||
IEntitySlim? entity = EntityService.Get(descendantKey, ItemObjectType)
|
||||
?? EntityService.Get(descendantKey, FolderObjectType);
|
||||
if (entity is null)
|
||||
{
|
||||
// not much else we can do here but return nothing
|
||||
return await Task.FromResult(Array.Empty<IEntitySlim>());
|
||||
return Task.FromResult(Array.Empty<IEntitySlim>());
|
||||
}
|
||||
|
||||
var ancestorIds = entity.AncestorIds();
|
||||
@@ -81,9 +81,12 @@ public abstract class FolderTreeControllerBase<TItem> : NamedEntityTreeControlle
|
||||
.GetAll(ItemObjectType, ancestorIds)
|
||||
.Union(containers)
|
||||
: Array.Empty<IEntitySlim>();
|
||||
ancestors = ancestors.Union(includeSelf ? new[] { entity } : Array.Empty<IEntitySlim>());
|
||||
if (includeSelf)
|
||||
{
|
||||
ancestors = ancestors.Append(entity);
|
||||
}
|
||||
|
||||
return ancestors.OrderBy(item => item.Level).ToArray();
|
||||
return Task.FromResult(ancestors.OrderBy(item => item.Level).ToArray());
|
||||
}
|
||||
|
||||
private IEntitySlim[] GetEntities(Guid? parentKey, int skip, int take, out long totalItems)
|
||||
@@ -94,7 +97,7 @@ public abstract class FolderTreeControllerBase<TItem> : NamedEntityTreeControlle
|
||||
|
||||
IEntitySlim[] itemEntities = EntityService.GetPagedChildren(
|
||||
parentKey,
|
||||
new [] { FolderObjectType, ItemObjectType },
|
||||
[FolderObjectType, ItemObjectType],
|
||||
childObjectTypes,
|
||||
skip,
|
||||
take,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Core.Mapping;
|
||||
@@ -26,7 +26,7 @@ public class SettingsUpgradeController : UpgradeControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(UpgradeSettingsResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status428PreconditionRequired)]
|
||||
public async Task<ActionResult<UpgradeSettingsResponseModel>> Settings(CancellationToken cancellationToken)
|
||||
public Task<ActionResult<UpgradeSettingsResponseModel>> Settings(CancellationToken cancellationToken)
|
||||
{
|
||||
// TODO: Async - We need to figure out what we want to do with async endpoints that doesn't do anything async
|
||||
// We want these to be async for future use (Ideally we'll have more async things),
|
||||
@@ -34,6 +34,6 @@ public class SettingsUpgradeController : UpgradeControllerBase
|
||||
UpgradeSettingsModel upgradeSettings = _upgradeSettingsFactory.GetUpgradeSettings();
|
||||
UpgradeSettingsResponseModel responseModel = _mapper.Map<UpgradeSettingsResponseModel>(upgradeSettings)!;
|
||||
|
||||
return await Task.FromResult(responseModel);
|
||||
return Task.FromResult<ActionResult<UpgradeSettingsResponseModel>>(responseModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -23,10 +23,10 @@ public class ResizeImagingController : ImagingControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpGet("resize/urls")]
|
||||
[ProducesResponseType(typeof(IEnumerable<MediaUrlInfoResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Urls([FromQuery(Name = "id")] HashSet<Guid> ids, int height = 200, int width = 200, ImageCropMode? mode = null)
|
||||
public Task<IActionResult> Urls([FromQuery(Name = "id")] HashSet<Guid> ids, int height = 200, int width = 200, ImageCropMode? mode = null)
|
||||
{
|
||||
IEnumerable<IMedia> items = _mediaService.GetByIds(ids);
|
||||
|
||||
return await Task.FromResult(Ok(_reziseImageUrlFactory.CreateUrlSets(items, height, width, mode)));
|
||||
return Task.FromResult<IActionResult>(Ok(_reziseImageUrlFactory.CreateUrlSets(items, height, width, mode)));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -18,10 +18,10 @@ public class ConfigurationCurrentUserController : CurrentUserControllerBase
|
||||
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpGet("configuration")]
|
||||
[ProducesResponseType(typeof(CurrenUserConfigurationResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(CurrentUserConfigurationResponseModel), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Configuration(CancellationToken cancellationToken)
|
||||
{
|
||||
CurrenUserConfigurationResponseModel model = await _userPresentationFactory.CreateCurrentUserConfigurationModelAsync();
|
||||
CurrentUserConfigurationResponseModel model = await _userPresentationFactory.CreateCurrentUserConfigurationModelAsync();
|
||||
return Ok(model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,12 @@ public class UserGroupControllerBase : ManagementApiControllerBase
|
||||
.WithDetail("The assigned media start node does not exists.")
|
||||
.Build()),
|
||||
UserGroupOperationStatus.DocumentPermissionKeyNotFound => NotFound(new ProblemDetailsBuilder()
|
||||
.WithTitle("A document permission key not found")
|
||||
.WithDetail("A assigned document permission not exists.")
|
||||
.WithTitle("Document permission key not found")
|
||||
.WithDetail("An assigned document permission does not reference an existing document.")
|
||||
.Build()),
|
||||
UserGroupOperationStatus.DocumentTypePermissionKeyNotFound => NotFound(new ProblemDetailsBuilder()
|
||||
.WithTitle("Document type permission key not found")
|
||||
.WithDetail("An assigned document type permission does not reference an existing document type.")
|
||||
.Build()),
|
||||
UserGroupOperationStatus.LanguageNotFound => NotFound(problemDetailsBuilder
|
||||
.WithTitle("Language not found")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -6,9 +6,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Extensions;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
@@ -20,14 +19,10 @@ internal static class ApplicationBuilderExtensions
|
||||
=> applicationBuilder.UseWhen(
|
||||
httpContext =>
|
||||
{
|
||||
GlobalSettings settings = httpContext.RequestServices
|
||||
.GetRequiredService<IOptions<GlobalSettings>>().Value;
|
||||
IHostingEnvironment hostingEnvironment =
|
||||
httpContext.RequestServices.GetRequiredService<IHostingEnvironment>();
|
||||
var officePath = settings.GetBackOfficePath(hostingEnvironment);
|
||||
var backOfficePath = httpContext.RequestServices.GetRequiredService<IHostingEnvironment>().GetBackOfficePath();
|
||||
|
||||
// Only use the API exception handler when we are requesting an API
|
||||
return httpContext.Request.Path.Value?.StartsWith($"{officePath}{Constants.Web.ManagementApiPath}") ?? false;
|
||||
return httpContext.Request.Path.Value?.StartsWith($"{backOfficePath}{Constants.Web.ManagementApiPath}") ?? false;
|
||||
},
|
||||
innerBuilder =>
|
||||
{
|
||||
@@ -58,14 +53,13 @@ internal static IApplicationBuilder UseEndpoints(this IApplicationBuilder applic
|
||||
|
||||
applicationBuilder.UseEndpoints(endpoints =>
|
||||
{
|
||||
GlobalSettings settings = provider.GetRequiredService<IOptions<GlobalSettings>>().Value;
|
||||
IHostingEnvironment hostingEnvironment = provider.GetRequiredService<IHostingEnvironment>();
|
||||
var officePath = settings.GetBackOfficePath(hostingEnvironment);
|
||||
var backOfficePath = provider.GetRequiredService<IHostingEnvironment>().GetBackOfficePath();
|
||||
|
||||
// Maps attribute routed controllers.
|
||||
endpoints.MapControllers();
|
||||
|
||||
// Serve contract
|
||||
endpoints.MapGet($"{officePath}{Constants.Web.ManagementApiPath}openapi.json", async context =>
|
||||
endpoints.MapGet($"{backOfficePath}{Constants.Web.ManagementApiPath}openapi.json", async context =>
|
||||
{
|
||||
await context.Response.SendFileAsync(new EmbeddedFileProvider(typeof(ManagementApiComposer).Assembly).GetFileInfo("OpenApi.json"));
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Infrastructure.Examine;
|
||||
using Umbraco.Cms.Api.Management.Factories;
|
||||
@@ -17,8 +17,8 @@ public static class SearchManagementBuilderExtensions
|
||||
|
||||
// Add factories
|
||||
builder.Services.AddTransient<IIndexDiagnosticsFactory, IndexDiagnosticsFactory>();
|
||||
builder.Services.AddTransient<IIndexRebuilder, ExamineIndexRebuilder>();
|
||||
builder.Services.AddTransient<IIndexPresentationFactory, IndexPresentationFactory>();
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,10 @@ public static partial class UmbracoBuilderExtensions
|
||||
.AddMembersIdentity()
|
||||
.AddUmbracoProfiler()
|
||||
.AddMvcAndRazor(configureMvc)
|
||||
.AddWebServer()
|
||||
.AddRecurringBackgroundJobs()
|
||||
.AddUmbracoHybridCache()
|
||||
.AddDistributedCache()
|
||||
.AddCoreNotifications()
|
||||
.AddExamine()
|
||||
.AddExamineIndexes();
|
||||
.AddCoreNotifications();
|
||||
|
||||
public static IUmbracoBuilder AddBackOfficeCore(this IUmbracoBuilder builder)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user