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,45 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Payroll.Income.Cqrs;
public class GetIncomeListResponse
{
public string? Id { get; set; }
public string? Code { get; set; }
public string? Name { get; set; }
public string? Type { get; set; }
public bool IsTaxable { get; set; }
public string? CalculationBase { get; set; }
public string? Status { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
}
public record GetIncomeListQuery() : IRequest<List<GetIncomeListResponse>>;
public class GetIncomeListHandler : IRequestHandler<GetIncomeListQuery, List<GetIncomeListResponse>>
{
private readonly AppDbContext _context;
public GetIncomeListHandler(AppDbContext context) => _context = context;
public async Task<List<GetIncomeListResponse>> Handle(GetIncomeListQuery request, CancellationToken cancellationToken)
{
return await _context.Income
.AsNoTracking()
.OrderBy(x => x.Code)
.Select(x => new GetIncomeListResponse
{
Id = x.Id,
Code = x.Code,
Name = x.Name,
Type = x.Type,
IsTaxable = x.IsTaxable,
CalculationBase = x.CalculationBase,
Status = x.Status,
CreatedAt = x.CreatedAt
})
.ToListAsync(cancellationToken);
}
}