initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
@@ -0,0 +1,55 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Pipeline.SalesRepresentative.Cqrs;
public class GetSalesRepresentativeByIdResponse
{
public string? Id { get; set; }
public string? AutoNumber { get; set; }
public string? Name { get; set; }
public string? JobTitle { get; set; }
public string? EmployeeNumber { get; set; }
public string? PhoneNumber { get; set; }
public string? EmailAddress { get; set; }
public string? Description { get; set; }
public string? SalesTeamId { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
}
public record GetSalesRepresentativeByIdQuery(string Id) : IRequest<GetSalesRepresentativeByIdResponse?>;
public class GetSalesRepresentativeByIdHandler : IRequestHandler<GetSalesRepresentativeByIdQuery, GetSalesRepresentativeByIdResponse?>
{
private readonly AppDbContext _context;
public GetSalesRepresentativeByIdHandler(AppDbContext context) => _context = context;
public async Task<GetSalesRepresentativeByIdResponse?> Handle(GetSalesRepresentativeByIdQuery request, CancellationToken cancellationToken)
{
return await _context.SalesRepresentative
.AsNoTracking()
.Where(x => x.Id == request.Id)
.Select(x => new GetSalesRepresentativeByIdResponse
{
Id = x.Id,
AutoNumber = x.AutoNumber,
Name = x.Name,
JobTitle = x.JobTitle,
EmployeeNumber = x.EmployeeNumber,
PhoneNumber = x.PhoneNumber,
EmailAddress = x.EmailAddress,
Description = x.Description,
SalesTeamId = x.SalesTeamId,
CreatedAt = x.CreatedAt,
CreatedBy = x.CreatedBy,
UpdatedAt = x.UpdatedAt,
UpdatedBy = x.UpdatedBy,
})
.FirstOrDefaultAsync(cancellationToken);
}
}