initial commit

This commit is contained in:
2026-07-21 14:35:37 +07:00
commit 0027997ff9
798 changed files with 59083 additions and 0 deletions
@@ -0,0 +1,85 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Organization.Employee.Cqrs;
public class GetEmployeeByIdResponse
{
public string? Id { get; set; }
public string? AutoNumber { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public string? Street { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? ZipCode { get; set; }
public string? Country { get; set; }
public string? PhoneNumber { get; set; }
public string? FaxNumber { get; set; }
public string? EmailAddress { get; set; }
public string? Website { get; set; }
public string? WhatsApp { get; set; }
public string? LinkedIn { get; set; }
public string? Facebook { get; set; }
public string? Instagram { get; set; }
public string? TwitterX { get; set; }
public string? TikTok { get; set; }
public string? EmployeeGroupId { get; set; }
public string? EmployeeCategoryId { get; set; }
public string? JobTitle { get; set; }
public decimal CommissionRate { get; set; }
public string? EmployeeNumber { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
}
public record GetEmployeeByIdQuery(string Id) : IRequest<GetEmployeeByIdResponse?>;
public class GetEmployeeByIdHandler : IRequestHandler<GetEmployeeByIdQuery, GetEmployeeByIdResponse?>
{
private readonly AppDbContext _context;
public GetEmployeeByIdHandler(AppDbContext context) => _context = context;
public async Task<GetEmployeeByIdResponse?> Handle(GetEmployeeByIdQuery request, CancellationToken cancellationToken)
{
return await _context.Employee
.AsNoTracking()
.Where(x => x.Id == request.Id)
.Select(x => new GetEmployeeByIdResponse
{
Id = x.Id,
AutoNumber = x.AutoNumber,
Name = x.Name,
Description = x.Description,
Street = x.Street,
City = x.City,
State = x.State,
ZipCode = x.ZipCode,
Country = x.Country,
PhoneNumber = x.PhoneNumber,
FaxNumber = x.FaxNumber,
EmailAddress = x.EmailAddress,
Website = x.Website,
WhatsApp = x.WhatsApp,
LinkedIn = x.LinkedIn,
Facebook = x.Facebook,
Instagram = x.Instagram,
TwitterX = x.TwitterX,
TikTok = x.TikTok,
EmployeeGroupId = x.EmployeeGroupId,
EmployeeCategoryId = x.EmployeeCategoryId,
JobTitle = x.JobTitle,
CommissionRate = x.CommissionRate,
EmployeeNumber = x.EmployeeNumber,
CreatedAt = x.CreatedAt,
CreatedBy = x.CreatedBy,
UpdatedAt = x.UpdatedAt,
UpdatedBy = x.UpdatedBy
})
.FirstOrDefaultAsync(cancellationToken);
}
}