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,51 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Payroll.PayrollDetails.Cqrs;
public class GetPayrollDetailListByProcessIdRequest
{
public string? PayrollProcessId { get; set; }
}
public class GetPayrollDetailListByProcessIdResponse
{
public string? Id { get; set; }
public string? EmployeeId { get; set; }
public string? EmployeeCode { get; set; }
public string? EmployeeName { get; set; }
public decimal BasicSalary { get; set; }
public decimal TotalIncome { get; set; }
public decimal TotalDeduction { get; set; }
public decimal TakeHomePay { get; set; }
}
public record GetPayrollDetailListByProcessIdQuery(GetPayrollDetailListByProcessIdRequest Data) : IRequest<List<GetPayrollDetailListByProcessIdResponse>>;
public class GetPayrollDetailListByProcessIdHandler : IRequestHandler<GetPayrollDetailListByProcessIdQuery, List<GetPayrollDetailListByProcessIdResponse>>
{
private readonly AppDbContext _context;
public GetPayrollDetailListByProcessIdHandler(AppDbContext context) => _context = context;
public async Task<List<GetPayrollDetailListByProcessIdResponse>> Handle(GetPayrollDetailListByProcessIdQuery request, CancellationToken cancellationToken)
{
var data = await _context.PayrollDetail
.Where(x => x.PayrollProcessId == request.Data.PayrollProcessId)
.Select(x => new GetPayrollDetailListByProcessIdResponse
{
Id = x.Id,
EmployeeId = x.EmployeeId,
EmployeeCode = x.EmployeeCode,
EmployeeName = x.EmployeeName,
BasicSalary = x.BasicSalary,
TotalIncome = x.TotalIncome,
TotalDeduction = x.TotalDeduction,
TakeHomePay = x.TakeHomePay
})
.ToListAsync(cancellationToken);
return data;
}
}