initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -0,0 +1,45 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Payroll.Deduction.Cqrs;
public class GetDeductionListResponse
{
public string? Id { get; set; }
public string? Code { get; set; }
public string? Name { get; set; }
public string? Category { get; set; }
public bool PreTax { get; set; }
public string? CalculationMethod { get; set; }
public string? Status { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
}
public record GetDeductionListQuery() : IRequest<List<GetDeductionListResponse>>;
public class GetDeductionListHandler : IRequestHandler<GetDeductionListQuery, List<GetDeductionListResponse>>
{
private readonly AppDbContext _context;
public GetDeductionListHandler(AppDbContext context) => _context = context;
public async Task<List<GetDeductionListResponse>> Handle(GetDeductionListQuery request, CancellationToken cancellationToken)
{
return await _context.Deduction
.AsNoTracking()
.OrderBy(x => x.Code)
.Select(x => new GetDeductionListResponse
{
Id = x.Id,
Code = x.Code,
Name = x.Name,
Category = x.Category,
PreTax = x.PreTax,
CalculationMethod = x.CalculationMethod,
Status = x.Status,
CreatedAt = x.CreatedAt
})
.ToListAsync(cancellationToken);
}
}