Add product categories CQRS handlers and gRPC endpoints
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace BackOffice.BFF.Application.ProductsCQ.Commands.UpdateProductCategories;
|
||||
|
||||
public record UpdateProductCategoriesCommand : IRequest<Unit>
|
||||
{
|
||||
public long ProductId { get; init; }
|
||||
public IReadOnlyCollection<long> CategoryIds { get; init; } = Array.Empty<long>();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using BackOffice.BFF.Application.Common.Interfaces;
|
||||
|
||||
namespace BackOffice.BFF.Application.ProductsCQ.Commands.UpdateProductCategories;
|
||||
|
||||
public class UpdateProductCategoriesCommandHandler : IRequestHandler<UpdateProductCategoriesCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public UpdateProductCategoriesCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(UpdateProductCategoriesCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
// Stub: until CMS Category services are available via the protobuf package,
|
||||
// this handler is a no-op to keep the pipeline consistent.
|
||||
await Task.CompletedTask;
|
||||
return Unit.Value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace BackOffice.BFF.Application.ProductsCQ.Queries.GetCategories;
|
||||
|
||||
public record GetCategoriesQuery : IRequest<GetCategoriesResponseDto>
|
||||
{
|
||||
public long ProductId { get; init; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using BackOffice.BFF.Application.Common.Interfaces;
|
||||
|
||||
namespace BackOffice.BFF.Application.ProductsCQ.Queries.GetCategories;
|
||||
|
||||
public class GetCategoriesQueryHandler : IRequestHandler<GetCategoriesQuery, GetCategoriesResponseDto>
|
||||
{
|
||||
public GetCategoriesQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
// context is currently unused; reserved for future CMS integration
|
||||
}
|
||||
|
||||
public async Task<GetCategoriesResponseDto> Handle(GetCategoriesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
// Stub implementation: returns empty list.
|
||||
// When CMS protobuf package with Category support is available,
|
||||
// this handler can be updated to call Category and PruductCategory services.
|
||||
await Task.CompletedTask;
|
||||
return new GetCategoriesResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace BackOffice.BFF.Application.ProductsCQ.Queries.GetCategories;
|
||||
|
||||
public class GetCategoriesResponseDto
|
||||
{
|
||||
public List<CategoryItemDto> Items { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CategoryItemDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public bool Selected { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user