Skip to content

Commit

Permalink
chore; namespacing for catalog API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
erikshafer committed Jun 22, 2024
1 parent d0de96e commit 2bc6c84
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
using Catalog.Api.Commands;
using Catalog.Prices;
using Eventuous;
using Eventuous.AspNetCore.Web;
using Microsoft.AspNetCore.Mvc;
using static Catalog.Api.Commands.PriceCommands;

namespace Catalog.Api.HttpApi;
namespace Catalog.Api.HttpApi.Prices;

[Route("/price")]
public class PriceCommandApi(ICommandService<Price> service) : CommandHttpApiBase<Price>(service)
{
[HttpPost]
[Route("initialize")]
public Task<ActionResult<Result>> Draft([FromBody] Initialize cmd, CancellationToken ct)
public Task<ActionResult<Result>> Draft([FromBody] PriceCommands.Initialize cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("activate")]
public Task<ActionResult<Result>> Activate([FromBody] Activate cmd, CancellationToken ct)
public Task<ActionResult<Result>> Activate([FromBody] PriceCommands.Activate cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("deprecate")]
public Task<ActionResult<Result>> Deprecate([FromBody] Deprecate cmd, CancellationToken ct)
public Task<ActionResult<Result>> Deprecate([FromBody] PriceCommands.Deprecate cmd, CancellationToken ct)
=> Handle(cmd, ct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Eventuous;
using Microsoft.AspNetCore.Mvc;

namespace Catalog.Api.HttpApi;
namespace Catalog.Api.HttpApi.Prices;

[Route("/prices")]
public class PriceQueryApi : ControllerBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
using Catalog.Api.Commands;
using Catalog.Products;
using Eventuous;
using Eventuous.AspNetCore.Web;
using Microsoft.AspNetCore.Mvc;
using static Catalog.Api.Commands.ProductCommands;

namespace Catalog.Api.HttpApi;
namespace Catalog.Api.HttpApi.Products;

[Route("/product")]
public class ProductCommandApi(ICommandService<Product> service) : CommandHttpApiBase<Product>(service)
{
[HttpPost]
[Route("draft-with-id")]
public Task<ActionResult<Result>> Draft([FromBody] DraftWithProvidedId cmd, CancellationToken ct)
public Task<ActionResult<Result>> Draft([FromBody] ProductCommands.DraftWithProvidedId cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("draft")]
public Task<ActionResult<Result>> Draft([FromBody] Draft cmd, CancellationToken ct)
public Task<ActionResult<Result>> Draft([FromBody] ProductCommands.Draft cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("activate")]
public Task<ActionResult<Result>> Activate([FromBody] Activate cmd, CancellationToken ct)
public Task<ActionResult<Result>> Activate([FromBody] ProductCommands.Activate cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("archive")]
public Task<ActionResult<Result>> Archive([FromBody] Archive cmd, CancellationToken ct)
public Task<ActionResult<Result>> Archive([FromBody] ProductCommands.Archive cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("cancel")]
public Task<ActionResult<Result>> Cancel([FromBody] Cancel cmd, CancellationToken ct)
public Task<ActionResult<Result>> Cancel([FromBody] ProductCommands.Cancel cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("adjust-description")]
public Task<ActionResult<Result>> AdjustDescription([FromBody] AdjustDescription cmd, CancellationToken ct)
public Task<ActionResult<Result>> AdjustDescription([FromBody] ProductCommands.AdjustDescription cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("adjust-name")]
public Task<ActionResult<Result>> AdjustName([FromBody] AdjustName cmd, CancellationToken ct)
public Task<ActionResult<Result>> AdjustName([FromBody] ProductCommands.AdjustName cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("adjust-brand")]
public Task<ActionResult<Result>> AdjustBrand([FromBody] AdjustBrand cmd, CancellationToken ct)
public Task<ActionResult<Result>> AdjustBrand([FromBody] ProductCommands.AdjustBrand cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("take-measurement")]
public Task<ActionResult<Result>> TakeMeasurement([FromBody] TakeMeasurement cmd, CancellationToken ct)
public Task<ActionResult<Result>> TakeMeasurement([FromBody] ProductCommands.TakeMeasurement cmd, CancellationToken ct)
=> Handle(cmd, ct);

[HttpPost]
[Route("remove-measurement")]
public Task<ActionResult<Result>> RemoveMeasurement([FromBody] RemoveMeasurement cmd, CancellationToken ct)
public Task<ActionResult<Result>> RemoveMeasurement([FromBody] ProductCommands.RemoveMeasurement cmd, CancellationToken ct)
=> Handle(cmd, ct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Eventuous;
using Microsoft.AspNetCore.Mvc;

namespace Catalog.Api.HttpApi;
namespace Catalog.Api.HttpApi.Products;

[Route("/products")]
public class ProductQueryApi : ControllerBase
Expand Down

0 comments on commit 2bc6c84

Please sign in to comment.