initial commit

This commit is contained in:
2026-07-21 15:36:49 +07:00
commit 77f66132bc
2640 changed files with 850901 additions and 0 deletions
@@ -0,0 +1,71 @@
using Application.Common.CQS.Queries;
using Application.Common.Extensions;
using AutoMapper;
using Domain.Entities;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Application.Features.TaxManager.Queries;
public record GetTaxListDto
{
public string? Id { get; init; }
public string? Name { get; init; }
public double? Percentage { get; init; }
public string? Description { get; init; }
public DateTime? CreatedAtUtc { get; init; }
}
public class GetTaxListProfile : Profile
{
public GetTaxListProfile()
{
CreateMap<Tax, GetTaxListDto>();
}
}
public class GetTaxListResult
{
public List<GetTaxListDto>? Data { get; init; }
}
public class GetTaxListRequest : IRequest<GetTaxListResult>
{
public bool IsDeleted { get; init; } = false;
}
public class GetTaxListHandler : IRequestHandler<GetTaxListRequest, GetTaxListResult>
{
private readonly IMapper _mapper;
private readonly IQueryContext _context;
public GetTaxListHandler(IMapper mapper, IQueryContext context)
{
_mapper = mapper;
_context = context;
}
public async Task<GetTaxListResult> Handle(GetTaxListRequest request, CancellationToken cancellationToken)
{
var query = _context
.Tax
.AsNoTracking()
.IsDeletedEqualTo(request.IsDeleted)
.AsQueryable();
var entities = await query.ToListAsync(cancellationToken);
var dtos = _mapper.Map<List<GetTaxListDto>>(entities);
return new GetTaxListResult
{
Data = dtos
};
}
}