initial commit

This commit is contained in:
2026-07-21 13:52:43 +07:00
commit f0e6f38940
881 changed files with 66309 additions and 0 deletions
@@ -0,0 +1,45 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Inventory.Warehouse.Cqrs;
public class GetWarehouseListResponse
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public bool? SystemWarehouse { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
}
public record GetWarehouseListQuery() : IRequest<List<GetWarehouseListResponse>>;
public class GetWarehouseListHandler : IRequestHandler<GetWarehouseListQuery, List<GetWarehouseListResponse>>
{
private readonly AppDbContext _context;
public GetWarehouseListHandler(AppDbContext context) => _context = context;
public async Task<List<GetWarehouseListResponse>> Handle(GetWarehouseListQuery request, CancellationToken cancellationToken)
{
return await _context.Warehouse
.AsNoTracking()
.OrderBy(x => x.Name)
.Select(x => new GetWarehouseListResponse
{
Id = x.Id,
Name = x.Name,
Description = x.Description,
SystemWarehouse = x.SystemWarehouse,
CreatedAt = x.CreatedAt,
CreatedBy = x.CreatedBy,
UpdatedAt = x.UpdatedAt,
UpdatedBy = x.UpdatedBy,
})
.ToListAsync(cancellationToken);
}
}