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,46 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Organization.Employee.Cqrs;
public class GetEmployeeDeductionListResponse
{
public string? Id { get; set; }
public string? DeductionId { get; set; }
public string? EmployeeCode { get; set; }
public string? DeductionName { get; set; }
public string? DeductionCategory { get; set; }
public decimal Amount { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; }
}
public record GetEmployeeDeductionListByEmployeeIdQuery(string EmployeeId) : IRequest<List<GetEmployeeDeductionListResponse>>;
public class GetEmployeeDeductionListByEmployeeIdHandler : IRequestHandler<GetEmployeeDeductionListByEmployeeIdQuery, List<GetEmployeeDeductionListResponse>>
{
private readonly AppDbContext _context;
public GetEmployeeDeductionListByEmployeeIdHandler(AppDbContext context) => _context = context;
public async Task<List<GetEmployeeDeductionListResponse>> Handle(GetEmployeeDeductionListByEmployeeIdQuery request, CancellationToken cancellationToken)
{
var data = await _context.EmployeeDeduction
.Where(x => x.EmployeeId == request.EmployeeId)
.Select(x => new GetEmployeeDeductionListResponse
{
Id = x.Id,
DeductionId = x.DeductionId,
EmployeeCode = x.Employee != null ? x.Employee.Code : string.Empty,
DeductionName = x.Deduction != null ? x.Deduction.Name : string.Empty,
DeductionCategory = x.Deduction != null ? x.Deduction.Category : string.Empty,
Amount = x.Amount,
Description = x.Description,
IsActive = x.IsActive
})
.OrderBy(x => x.DeductionName)
.ToListAsync(cancellationToken);
return data;
}
}