Browse Source

Upgrade ardalis.ApiEndpoints to v2. (#451)

main
Shady Nagy 5 years ago
committed by GitHub
parent
commit
d5610aad12
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/PublicApi/AuthEndpoints/Authenticate.cs
  2. 3
      src/PublicApi/CatalogBrandEndpoints/List.cs
  3. 3
      src/PublicApi/CatalogItemEndpoints/Create.cs
  4. 5
      src/PublicApi/CatalogItemEndpoints/Delete.cs
  5. 5
      src/PublicApi/CatalogItemEndpoints/GetById.cs
  6. 3
      src/PublicApi/CatalogItemEndpoints/ListPaged.cs
  7. 3
      src/PublicApi/CatalogItemEndpoints/Update.cs
  8. 3
      src/PublicApi/CatalogTypeEndpoints/List.cs
  9. 2
      src/PublicApi/PublicApi.csproj
  10. 2
      src/Web/Web.csproj

10
src/PublicApi/AuthEndpoints/Authenticate.cs

@ -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());

3
src/PublicApi/CatalogBrandEndpoints/List.cs

@ -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();

3
src/PublicApi/CatalogItemEndpoints/Create.cs

@ -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());

5
src/PublicApi/CatalogItemEndpoints/Delete.cs

@ -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());

5
src/PublicApi/CatalogItemEndpoints/GetById.cs

@ -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());

3
src/PublicApi/CatalogItemEndpoints/ListPaged.cs

@ -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());

3
src/PublicApi/CatalogItemEndpoints/Update.cs

@ -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());

3
src/PublicApi/CatalogTypeEndpoints/List.cs

@ -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();

2
src/PublicApi/PublicApi.csproj

@ -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" />

2
src/Web/Web.csproj

@ -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" />

Loading…
Cancel
Save