Skip to content

Commit b5ea1f3

Browse files
authored
Merge pull request #27 from zribktad/feature/product-split
Refactor ProductCatalog with batch operations and organized namespaces
2 parents 2fbaf15 + 44be303 commit b5ea1f3

112 files changed

Lines changed: 235 additions & 224 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/APITemplate/Api/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using JasperFx;
1111
using JasperFx.Resources;
1212
using ProductCatalog;
13-
using ProductCatalog.Features.CreateProducts;
13+
using ProductCatalog.Features.Product.CreateProducts;
1414
using ProductCatalog.Handlers;
1515
using Reviews;
1616
using Reviews.Features;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Mvc;
3+
using SharedKernel.Contracts.Api;
4+
using Wolverine;
5+
6+
namespace ProductCatalog.Features.Category;
7+
8+
[ApiVersion(1.0)]
9+
public sealed partial class CategoriesController(IMessageBus bus) : ApiControllerBase { }

src/Modules/ProductCatalog/Features/CreateCategories/CreateCategoriesController.cs renamed to src/Modules/ProductCatalog/Features/Category/CreateCategories/CategoriesController.CreateCategories.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
using Asp.Versioning;
21
using ErrorOr;
32
using Microsoft.AspNetCore.Mvc;
3+
using ProductCatalog.Features.Category.CreateCategories;
44
using SharedKernel.Contracts.Api;
55
using SharedKernel.Contracts.Security;
6-
using Wolverine;
76

8-
namespace ProductCatalog.Features.CreateCategories;
7+
namespace ProductCatalog.Features.Category;
98

10-
[ApiVersion(1.0)]
11-
public sealed class CreateCategoriesController(IMessageBus bus) : ApiControllerBase
9+
public sealed partial class CategoriesController
1210
{
1311
/// <summary>Creates multiple categories in a single batch operation.</summary>
1412
[HttpPost]

src/Modules/ProductCatalog/Features/CreateCategories/CreateCategoriesCommand.cs renamed to src/Modules/ProductCatalog/Features/Category/CreateCategories/CreateCategoriesCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Wolverine;
66
using CategoryEntity = ProductCatalog.Entities.Category;
77

8-
namespace ProductCatalog.Features.CreateCategories;
8+
namespace ProductCatalog.Features.Category.CreateCategories;
99

1010
/// <summary>Creates multiple categories in a single batch operation.</summary>
1111
public sealed record CreateCategoriesCommand(CreateCategoriesRequest Request);

src/Modules/ProductCatalog/Features/CreateCategories/CreateCategoriesRequest.cs renamed to src/Modules/ProductCatalog/Features/Category/CreateCategories/CreateCategoriesRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.ComponentModel.DataAnnotations;
22

3-
namespace ProductCatalog.Features.CreateCategories;
3+
namespace ProductCatalog.Features.Category.CreateCategories;
44

55
/// <summary>
66
/// Carries a list of category items to be created in a single batch operation; accepts between 1 and 100 items.

src/Modules/ProductCatalog/Features/CreateCategories/CreateCategoryRequest.cs renamed to src/Modules/ProductCatalog/Features/Category/CreateCategories/CreateCategoryRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.ComponentModel.DataAnnotations;
22
using SharedKernel.Application.Validation;
33

4-
namespace ProductCatalog.Features.CreateCategories;
4+
namespace ProductCatalog.Features.Category.CreateCategories;
55

66
/// <summary>
77
/// Payload for creating a new category, carrying the name and optional description.

src/Modules/ProductCatalog/Features/CreateCategories/CreateCategoryRequestValidator.cs renamed to src/Modules/ProductCatalog/Features/Category/CreateCategories/CreateCategoryRequestValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using SharedKernel.Application.Validation;
22

3-
namespace ProductCatalog.Features.CreateCategories;
3+
namespace ProductCatalog.Features.Category.CreateCategories;
44

55
/// <summary>
66
/// FluentValidation validator for <see cref="CreateCategoryRequest"/> that enforces data-annotation constraints.

src/Modules/ProductCatalog/Features/DeleteCategories/DeleteCategoriesController.cs renamed to src/Modules/ProductCatalog/Features/Category/DeleteCategories/CategoriesController.DeleteCategories.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
using Asp.Versioning;
21
using ErrorOr;
32
using Microsoft.AspNetCore.Mvc;
3+
using ProductCatalog.Features.Category.DeleteCategories;
44
using SharedKernel.Contracts.Api;
55
using SharedKernel.Contracts.Security;
6-
using Wolverine;
76

8-
namespace ProductCatalog.Features.DeleteCategories;
7+
namespace ProductCatalog.Features.Category;
98

10-
[ApiVersion(1.0)]
11-
public sealed class DeleteCategoriesController(IMessageBus bus) : ApiControllerBase
9+
public sealed partial class CategoriesController
1210
{
1311
/// <summary>Soft-deletes multiple categories in a single batch operation.</summary>
1412
[HttpDelete]

src/Modules/ProductCatalog/Features/DeleteCategories/DeleteCategoriesCommand.cs renamed to src/Modules/ProductCatalog/Features/Category/DeleteCategories/DeleteCategoriesCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using ProductCatalog;
33
using Wolverine;
44

5-
namespace ProductCatalog.Features.DeleteCategories;
5+
namespace ProductCatalog.Features.Category.DeleteCategories;
66

77
/// <summary>Soft-deletes multiple categories in a single batch operation.</summary>
88
public sealed record DeleteCategoriesCommand(BatchDeleteRequest Request);

src/Modules/ProductCatalog/Features/GetCategories/GetCategoriesController.cs renamed to src/Modules/ProductCatalog/Features/Category/GetCategories/CategoriesController.GetCategories.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
using Asp.Versioning;
21
using ErrorOr;
32
using Microsoft.AspNetCore.Mvc;
43
using Microsoft.AspNetCore.OutputCaching;
4+
using ProductCatalog.Features.Category.GetCategories;
55
using SharedKernel.Contracts.Api;
66
using SharedKernel.Contracts.Security;
7-
using Wolverine;
87

9-
namespace ProductCatalog.Features.GetCategories;
8+
namespace ProductCatalog.Features.Category;
109

11-
[ApiVersion(1.0)]
12-
public sealed class GetCategoriesController(IMessageBus bus) : ApiControllerBase
10+
public sealed partial class CategoriesController
1311
{
1412
/// <summary>Returns a paginated, filterable list of categories from the output cache.</summary>
1513
[HttpGet]

0 commit comments

Comments
 (0)