initial commit

This commit is contained in:
2026-07-21 13:59:38 +07:00
commit c40792266a
1321 changed files with 100465 additions and 0 deletions
@@ -0,0 +1,41 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Setting.Company.Cqrs;
public class GetCompanyListResponse
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? City { get; set; }
public bool IsDefault { get; set; }
}
public record GetCompanyListQuery() : IRequest<List<GetCompanyListResponse>>;
public class GetCompanyListHandler : IRequestHandler<GetCompanyListQuery, List<GetCompanyListResponse>>
{
private readonly AppDbContext _context;
public GetCompanyListHandler(AppDbContext context) => _context = context;
public async Task<List<GetCompanyListResponse>> Handle(GetCompanyListQuery request, CancellationToken cancellationToken)
{
return await _context.Company
.AsNoTracking()
.OrderBy(x => x.Name)
.Select(x => new GetCompanyListResponse
{
Id = x.Id,
Name = x.Name,
Email = x.Email,
Phone = x.Phone,
City = x.City,
IsDefault = x.IsDefault
})
.ToListAsync(cancellationToken);
}
}