initial commit

This commit is contained in:
2026-07-21 14:08:10 +07:00
commit f7cf118326
533 changed files with 41762 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 GetEmployeeIncomeListResponse
{
public string? Id { get; set; }
public string? IncomeId { get; set; }
public string? EmployeeCode { get; set; }
public string? IncomeName { get; set; }
public string? IncomeType { get; set; }
public decimal Amount { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; }
}
public record GetEmployeeIncomeListByEmployeeIdQuery(string EmployeeId) : IRequest<List<GetEmployeeIncomeListResponse>>;
public class GetEmployeeIncomeListByEmployeeIdHandler : IRequestHandler<GetEmployeeIncomeListByEmployeeIdQuery, List<GetEmployeeIncomeListResponse>>
{
private readonly AppDbContext _context;
public GetEmployeeIncomeListByEmployeeIdHandler(AppDbContext context) => _context = context;
public async Task<List<GetEmployeeIncomeListResponse>> Handle(GetEmployeeIncomeListByEmployeeIdQuery request, CancellationToken cancellationToken)
{
var data = await _context.EmployeeIncome
.Where(x => x.EmployeeId == request.EmployeeId)
.Select(x => new GetEmployeeIncomeListResponse
{
Id = x.Id,
IncomeId = x.IncomeId,
EmployeeCode = x.Employee != null ? x.Employee.Code : string.Empty,
IncomeName = x.Income != null ? x.Income.Name : string.Empty,
IncomeType = x.Income != null ? x.Income.Type : string.Empty,
Amount = x.Amount,
Description = x.Description,
IsActive = x.IsActive
})
.OrderBy(x => x.IncomeName)
.ToListAsync(cancellationToken);
return data;
}
}