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,54 @@
using Indotalent.ConfigBackEnd.Extensions;
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Performance.Appraisal.Cqrs;
public class GetAppraisalListResponse
{
public string? Id { get; set; }
public string? AutoNumber { get; set; }
public string? EmployeeId { get; set; }
public string? EmployeeCode { get; set; }
public string? EmployeeName { get; set; }
public string? LastRating { get; set; }
public decimal CurrentSalary { get; set; }
public decimal IncrementPercentage { get; set; }
public decimal NewSalary { get; set; }
public string? Status { get; set; }
public DateTime EffectiveDate { get; set; }
}
public record GetAppraisalListQuery() : IRequest<List<GetAppraisalListResponse>>;
public class GetAppraisalListHandler : IRequestHandler<GetAppraisalListQuery, List<GetAppraisalListResponse>>
{
private readonly AppDbContext _context;
public GetAppraisalListHandler(AppDbContext context) => _context = context;
public async Task<List<GetAppraisalListResponse>> Handle(GetAppraisalListQuery request, CancellationToken cancellationToken)
{
return await _context.Appraisal
.AsNoTracking()
.NotDeletedOnly()
.Include(x => x.Employee)
.OrderByDescending(x => x.EffectiveDate)
.Select(x => new GetAppraisalListResponse
{
Id = x.Id,
AutoNumber = x.AutoNumber,
EmployeeId = x.EmployeeId,
EmployeeCode = x.Employee != null ? x.Employee.Code : string.Empty,
EmployeeName = x.Employee != null ? $"{x.Employee.FirstName} {x.Employee.LastName}" : string.Empty,
LastRating = x.LastRating,
CurrentSalary = x.CurrentSalary,
IncrementPercentage = x.IncrementPercentage,
NewSalary = x.NewSalary,
Status = x.Status,
EffectiveDate = x.EffectiveDate
})
.ToListAsync(cancellationToken);
}
}