initial commit

This commit is contained in:
2026-07-21 14:41:46 +07:00
commit 1bfa3dd1c2
1159 changed files with 88228 additions and 0 deletions
@@ -0,0 +1,40 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Inventory.Scrapping.Cqrs;
public class GetScrappingListResponse
{
public string? Id { get; set; }
public string? AutoNumber { get; set; }
public DateTime? ScrappingDate { get; set; }
public Data.Enums.ScrappingStatus Status { get; set; }
public string? WarehouseName { get; set; }
public string? Description { get; set; }
}
public record GetScrappingListQuery() : IRequest<List<GetScrappingListResponse>>;
public class GetScrappingListHandler : IRequestHandler<GetScrappingListQuery, List<GetScrappingListResponse>>
{
private readonly AppDbContext _context;
public GetScrappingListHandler(AppDbContext context) => _context = context;
public async Task<List<GetScrappingListResponse>> Handle(GetScrappingListQuery request, CancellationToken cancellationToken)
{
return await _context.Scrapping
.AsNoTracking()
.Include(x => x.Warehouse)
.OrderByDescending(x => x.CreatedAt)
.Select(x => new GetScrappingListResponse
{
Id = x.Id,
AutoNumber = x.AutoNumber,
ScrappingDate = x.ScrappingDate,
Status = x.Status,
WarehouseName = x.Warehouse!.Name,
Description = x.Description
}).ToListAsync(cancellationToken);
}
}