Skip to content

Commit

Permalink
Upgrade ardalis.ApiEndpoints to v2. (dotnet-architecture#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadyNagy authored Aug 7, 2020
1 parent 754c845 commit d5610aa
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/PublicApi/AuthEndpoints/Authenticate.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopWeb.ApplicationCore.Constants;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Microsoft.eShopWeb.Infrastructure.Identity;
using Microsoft.IdentityModel.Tokens;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.PublicApi.AuthEndpoints
Expand All @@ -34,7 +28,7 @@ public Authenticate(SignInManager<ApplicationUser> signInManager,
OperationId = "auth.authenticate",
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());

Expand Down
3 changes: 2 additions & 1 deletion src/PublicApi/CatalogBrandEndpoints/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
Expand All @@ -28,7 +29,7 @@ public List(IAsyncRepository<CatalogBrand> catalogBrandRepository,
OperationId = "catalog-brands.List",
Tags = new[] { "CatalogBrandEndpoints" })
]
public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync()
public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync(CancellationToken cancellationToken)
{
var response = new ListCatalogBrandsResponse();

Expand Down
3 changes: 2 additions & 1 deletion src/PublicApi/CatalogItemEndpoints/Create.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Threading;
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -32,7 +33,7 @@ public Create(IAsyncRepository<CatalogItem> itemRepository, IUriComposer uriComp
OperationId = "catalog-items.create",
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());

Expand Down
5 changes: 3 additions & 2 deletions src/PublicApi/CatalogItemEndpoints/Delete.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Ardalis.ApiEndpoints;
using System.Threading;
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand Down Expand Up @@ -27,7 +28,7 @@ public Delete(IAsyncRepository<CatalogItem> itemRepository)
OperationId = "catalog-items.Delete",
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());

Expand Down
5 changes: 3 additions & 2 deletions src/PublicApi/CatalogItemEndpoints/GetById.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Ardalis.ApiEndpoints;
using System.Threading;
using Ardalis.ApiEndpoints;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
Expand All @@ -25,7 +26,7 @@ public GetById(IAsyncRepository<CatalogItem> itemRepository, IUriComposer uriCom
OperationId = "catalog-items.GetById",
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());

Expand Down
3 changes: 2 additions & 1 deletion src/PublicApi/CatalogItemEndpoints/ListPaged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
Expand All @@ -33,7 +34,7 @@ public ListPaged(IAsyncRepository<CatalogItem> itemRepository,
OperationId = "catalog-items.ListPaged",
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());

Expand Down
3 changes: 2 additions & 1 deletion src/PublicApi/CatalogItemEndpoints/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints
Expand All @@ -32,7 +33,7 @@ public Update(IAsyncRepository<CatalogItem> itemRepository, IUriComposer uriComp
OperationId = "catalog-items.update",
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());

Expand Down
3 changes: 2 additions & 1 deletion src/PublicApi/CatalogTypeEndpoints/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Swashbuckle.AspNetCore.Annotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.PublicApi.CatalogTypeEndpoints
Expand All @@ -28,7 +29,7 @@ public List(IAsyncRepository<CatalogType> catalogTypeRepository,
OperationId = "catalog-types.List",
Tags = new[] { "CatalogTypeEndpoints" })
]
public override async Task<ActionResult<ListCatalogTypesResponse>> HandleAsync()
public override async Task<ActionResult<ListCatalogTypesResponse>> HandleAsync(CancellationToken cancellationToken)
{
var response = new ListCatalogTypesResponse();

Expand Down
2 changes: 1 addition & 1 deletion src/PublicApi/PublicApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<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="MediatR" Version="8.0.2" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<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.Specification" Version="4.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
Expand Down

0 comments on commit d5610aa

Please sign in to comment.