Upgrade ardalis.ApiEndpoints to v2. (#451)

This commit is contained in:
Shady Nagy
2020-08-07 23:19:32 +02:00
committed by GitHub
parent 754c845e9f
commit d5610aad12
10 changed files with 20 additions and 19 deletions

View File

@@ -1,16 +1,10 @@
using Ardalis.ApiEndpoints; using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopWeb.ApplicationCore.Constants;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Microsoft.eShopWeb.Infrastructure.Identity; using Microsoft.eShopWeb.Infrastructure.Identity;
using Microsoft.IdentityModel.Tokens;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System.Threading;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.PublicApi.AuthEndpoints namespace Microsoft.eShopWeb.PublicApi.AuthEndpoints
@@ -34,7 +28,7 @@ namespace Microsoft.eShopWeb.PublicApi.AuthEndpoints
OperationId = "auth.authenticate", OperationId = "auth.authenticate",
Tags = new[] { "AuthEndpoints" }) Tags = new[] { "AuthEndpoints" })
] ]
public override async Task<ActionResult<AuthenticateResponse>> HandleAsync(AuthenticateRequest request) public override async Task<ActionResult<AuthenticateResponse>> HandleAsync(AuthenticateRequest request, CancellationToken cancellationToken)
{ {
var response = new AuthenticateResponse(request.CorrelationId()); var response = new AuthenticateResponse(request.CorrelationId());

View File

@@ -5,6 +5,7 @@ using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
@@ -28,7 +29,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
OperationId = "catalog-brands.List", OperationId = "catalog-brands.List",
Tags = new[] { "CatalogBrandEndpoints" }) Tags = new[] { "CatalogBrandEndpoints" })
] ]
public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync() public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync(CancellationToken cancellationToken)
{ {
var response = new ListCatalogBrandsResponse(); var response = new ListCatalogBrandsResponse();

View File

@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Threading;
using Ardalis.ApiEndpoints; using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@@ -32,7 +33,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
OperationId = "catalog-items.create", OperationId = "catalog-items.create",
Tags = new[] { "CatalogItemEndpoints" }) Tags = new[] { "CatalogItemEndpoints" })
] ]
public override async Task<ActionResult<CreateCatalogItemResponse>> HandleAsync(CreateCatalogItemRequest request) public override async Task<ActionResult<CreateCatalogItemResponse>> HandleAsync(CreateCatalogItemRequest request, CancellationToken cancellationToken)
{ {
var response = new CreateCatalogItemResponse(request.CorrelationId()); var response = new CreateCatalogItemResponse(request.CorrelationId());

View File

@@ -1,4 +1,5 @@
using Ardalis.ApiEndpoints; using System.Threading;
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@@ -27,7 +28,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
OperationId = "catalog-items.Delete", OperationId = "catalog-items.Delete",
Tags = new[] { "CatalogItemEndpoints" }) Tags = new[] { "CatalogItemEndpoints" })
] ]
public override async Task<ActionResult<DeleteCatalogItemResponse>> HandleAsync([FromRoute]DeleteCatalogItemRequest request) public override async Task<ActionResult<DeleteCatalogItemResponse>> HandleAsync([FromRoute]DeleteCatalogItemRequest request, CancellationToken cancellationToken)
{ {
var response = new DeleteCatalogItemResponse(request.CorrelationId()); var response = new DeleteCatalogItemResponse(request.CorrelationId());

View File

@@ -1,4 +1,5 @@
using Ardalis.ApiEndpoints; using System.Threading;
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
@@ -25,7 +26,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
OperationId = "catalog-items.GetById", OperationId = "catalog-items.GetById",
Tags = new[] { "CatalogItemEndpoints" }) Tags = new[] { "CatalogItemEndpoints" })
] ]
public override async Task<ActionResult<GetByIdCatalogItemResponse>> HandleAsync([FromRoute] GetByIdCatalogItemRequest request) public override async Task<ActionResult<GetByIdCatalogItemResponse>> HandleAsync([FromRoute] GetByIdCatalogItemRequest request, CancellationToken cancellationToken)
{ {
var response = new GetByIdCatalogItemResponse(request.CorrelationId()); var response = new GetByIdCatalogItemResponse(request.CorrelationId());

View File

@@ -7,6 +7,7 @@ using Microsoft.eShopWeb.ApplicationCore.Specifications;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System; using System;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
@@ -33,7 +34,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
OperationId = "catalog-items.ListPaged", OperationId = "catalog-items.ListPaged",
Tags = new[] { "CatalogItemEndpoints" }) Tags = new[] { "CatalogItemEndpoints" })
] ]
public override async Task<ActionResult<ListPagedCatalogItemResponse>> HandleAsync([FromQuery]ListPagedCatalogItemRequest request) public override async Task<ActionResult<ListPagedCatalogItemResponse>> HandleAsync([FromQuery]ListPagedCatalogItemRequest request, CancellationToken cancellationToken)
{ {
var response = new ListPagedCatalogItemResponse(request.CorrelationId()); var response = new ListPagedCatalogItemResponse(request.CorrelationId());

View File

@@ -6,6 +6,7 @@ using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.IO; using System.IO;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
@@ -32,7 +33,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
OperationId = "catalog-items.update", OperationId = "catalog-items.update",
Tags = new[] { "CatalogItemEndpoints" }) Tags = new[] { "CatalogItemEndpoints" })
] ]
public override async Task<ActionResult<UpdateCatalogItemResponse>> HandleAsync(UpdateCatalogItemRequest request) public override async Task<ActionResult<UpdateCatalogItemResponse>> HandleAsync(UpdateCatalogItemRequest request, CancellationToken cancellationToken)
{ {
var response = new UpdateCatalogItemResponse(request.CorrelationId()); var response = new UpdateCatalogItemResponse(request.CorrelationId());

View File

@@ -5,6 +5,7 @@ using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.PublicApi.CatalogTypeEndpoints namespace Microsoft.eShopWeb.PublicApi.CatalogTypeEndpoints
@@ -28,7 +29,7 @@ namespace Microsoft.eShopWeb.PublicApi.CatalogTypeEndpoints
OperationId = "catalog-types.List", OperationId = "catalog-types.List",
Tags = new[] { "CatalogTypeEndpoints" }) Tags = new[] { "CatalogTypeEndpoints" })
] ]
public override async Task<ActionResult<ListCatalogTypesResponse>> HandleAsync() public override async Task<ActionResult<ListCatalogTypesResponse>> HandleAsync(CancellationToken cancellationToken)
{ {
var response = new ListCatalogTypesResponse(); var response = new ListCatalogTypesResponse();

View File

@@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Ardalis.ApiEndpoints" Version="1.0.0" /> <PackageReference Include="Ardalis.ApiEndpoints" Version="2.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="MediatR" Version="8.0.2" /> <PackageReference Include="MediatR" Version="8.0.2" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.1" /> <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.1" />

View File

@@ -20,7 +20,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Ardalis.ApiEndpoints" Version="1.0.0" /> <PackageReference Include="Ardalis.ApiEndpoints" Version="2.0.0" />
<PackageReference Include="Ardalis.ListStartupServices" Version="1.1.3" /> <PackageReference Include="Ardalis.ListStartupServices" Version="1.1.3" />
<PackageReference Include="Ardalis.Specification" Version="4.0.0" /> <PackageReference Include="Ardalis.Specification" Version="4.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />