Add validators and services for Product Galleries and Product Tags
- Implemented Create, Delete, Get, and Update validators for Product Galleries. - Added Create, Delete, Get, and Update validators for Product Tags. - Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags. - Each service class integrates with CQRS for command and query handling. - Established mapping profiles for Product Galleries.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using CMSMicroservice.Protobuf.Protos.DiscountCategory;
|
||||
using CMSMicroservice.WebApi.Common.Services;
|
||||
using CMSMicroservice.Application.DiscountShopCQ.Commands.CreateDiscountCategory;
|
||||
using CMSMicroservice.Application.DiscountShopCQ.Commands.UpdateDiscountCategory;
|
||||
using CMSMicroservice.Application.DiscountShopCQ.Commands.DeleteDiscountCategory;
|
||||
using CMSMicroservice.Application.DiscountShopCQ.Queries.GetDiscountCategories;
|
||||
|
||||
namespace CMSMicroservice.WebApi.Services;
|
||||
|
||||
public class DiscountCategoryService : DiscountCategoryContract.DiscountCategoryContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public DiscountCategoryService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
|
||||
public override async Task<CreateDiscountCategoryResponse> CreateDiscountCategory(CreateDiscountCategoryRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<CreateDiscountCategoryRequest, CreateDiscountCategoryCommand, CreateDiscountCategoryResponse>(request, context);
|
||||
}
|
||||
|
||||
public override async Task<Empty> UpdateDiscountCategory(UpdateDiscountCategoryRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<UpdateDiscountCategoryRequest, UpdateDiscountCategoryCommand>(request, context);
|
||||
}
|
||||
|
||||
public override async Task<Empty> DeleteDiscountCategory(DeleteDiscountCategoryRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<DeleteDiscountCategoryRequest, DeleteDiscountCategoryCommand>(request, context);
|
||||
}
|
||||
|
||||
public override async Task<GetDiscountCategoriesResponse> GetDiscountCategories(GetDiscountCategoriesRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetDiscountCategoriesRequest, GetDiscountCategoriesQuery, GetDiscountCategoriesResponse>(request, context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user