Implement Inventory Management Service with CRUD operations for warehouses and inventory items, stock operations, and bulk processing capabilities.
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s

This commit is contained in:
masoodafar-web
2026-01-02 00:45:37 +03:30
parent f0117eb1d5
commit 1cf501711f
50 changed files with 10699 additions and 101 deletions
@@ -1,13 +1,21 @@
using CMSMicroservice.Application.Common.Interfaces;
using CMSMicroservice.Domain.Entities;
using CMSMicroservice.Domain.Enums;
using CMSMicroservice.Domain.Events;
namespace CMSMicroservice.Application.ProductsCQ.Commands.CreateNewProducts;
public class CreateNewProductsCommandHandler : IRequestHandler<CreateNewProductsCommand, CreateNewProductsResponseDto>
{
private readonly IApplicationDbContext _context;
private readonly IInventoryService _inventoryService;
public CreateNewProductsCommandHandler(IApplicationDbContext context)
public CreateNewProductsCommandHandler(
IApplicationDbContext context,
IInventoryService inventoryService)
{
_context = context;
_inventoryService = inventoryService;
}
public async Task<CreateNewProductsResponseDto> Handle(CreateNewProductsCommand request,
@@ -17,6 +25,13 @@ public class CreateNewProductsCommandHandler : IRequestHandler<CreateNewProducts
await _context.Products.AddAsync(entity, cancellationToken);
await _context.SaveChangesAsync(cancellationToken);
// ایجاد رکورد موجودی در سیستم انبارداری
await _inventoryService.InitializeInventoryAsync(
entity.Id,
ProductType.RegularProduct,
request.RemainingCount,
ct: cancellationToken);
// ثبت دسته‌بندی‌های محصول (در صورت ارسال)
if (request.CategoryIds is { Count: > 0 })
{