initial commit

This commit is contained in:
2026-07-21 13:38:38 +07:00
commit 5047288f04
777 changed files with 57255 additions and 0 deletions
@@ -0,0 +1,43 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Thirdparty.CustomerGroup.Cqrs;
public class GetCustomerGroupByIdResponse
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
}
public record GetCustomerGroupByIdQuery(string Id) : IRequest<GetCustomerGroupByIdResponse?>;
public class GetCustomerGroupByIdHandler : IRequestHandler<GetCustomerGroupByIdQuery, GetCustomerGroupByIdResponse?>
{
private readonly AppDbContext _context;
public GetCustomerGroupByIdHandler(AppDbContext context) => _context = context;
public async Task<GetCustomerGroupByIdResponse?> Handle(GetCustomerGroupByIdQuery request, CancellationToken cancellationToken)
{
return await _context.CustomerGroup
.AsNoTracking()
.Where(x => x.Id == request.Id)
.Select(x => new GetCustomerGroupByIdResponse
{
Id = x.Id,
Name = x.Name,
Description = x.Description,
CreatedAt = x.CreatedAt,
CreatedBy = x.CreatedBy,
UpdatedAt = x.UpdatedAt,
UpdatedBy = x.UpdatedBy,
})
.FirstOrDefaultAsync(cancellationToken);
}
}