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:
masoodafar-web
2025-12-04 02:40:49 +03:30
parent 40d54d08fc
commit f0f48118e7
436 changed files with 33159 additions and 2005 deletions

View File

@@ -0,0 +1,11 @@
using MediatR;
namespace CMSMicroservice.Application.OrderVATCQ.Queries.GetOrderVAT;
/// <summary>
/// کوئری دریافت اطلاعات مالیات سفارش
/// </summary>
public class GetOrderVATQuery : IRequest<OrderVATDto?>
{
public long OrderId { get; set; }
}

View File

@@ -0,0 +1,52 @@
using CMSMicroservice.Application.Common.Interfaces;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace CMSMicroservice.Application.OrderVATCQ.Queries.GetOrderVAT;
public class GetOrderVATQueryHandler : IRequestHandler<GetOrderVATQuery, OrderVATDto?>
{
private readonly IApplicationDbContext _context;
private readonly ILogger<GetOrderVATQueryHandler> _logger;
public GetOrderVATQueryHandler(
IApplicationDbContext context,
ILogger<GetOrderVATQueryHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<OrderVATDto?> Handle(GetOrderVATQuery request, CancellationToken cancellationToken)
{
var orderVAT = await _context.OrderVATs
.Where(x => x.OrderId == request.OrderId && !x.IsDeleted)
.Select(x => new OrderVATDto
{
Id = x.Id,
OrderId = x.OrderId,
VATRate = x.VATRate,
VATRatePercentage = $"{x.VATRate * 100:F1}%",
BaseAmount = x.BaseAmount,
VATAmount = x.VATAmount,
TotalAmount = x.TotalAmount,
IsPaid = x.IsPaid,
PaidAt = x.PaidAt,
Note = x.Note,
Created = x.Created
})
.FirstOrDefaultAsync(cancellationToken);
if (orderVAT != null)
{
_logger.LogInformation(
"Retrieved VAT for order {OrderId}. VAT Amount: {VATAmount}",
request.OrderId,
orderVAT.VATAmount
);
}
return orderVAT;
}
}

View File

@@ -0,0 +1,19 @@
namespace CMSMicroservice.Application.OrderVATCQ.Queries.GetOrderVAT;
/// <summary>
/// DTO اطلاعات مالیات سفارش
/// </summary>
public class OrderVATDto
{
public long Id { get; set; }
public long OrderId { get; set; }
public decimal VATRate { get; set; }
public string VATRatePercentage { get; set; } = string.Empty;
public long BaseAmount { get; set; }
public long VATAmount { get; set; }
public long TotalAmount { get; set; }
public bool IsPaid { get; set; }
public DateTime? PaidAt { get; set; }
public string? Note { get; set; }
public DateTime Created { get; set; }
}