ref: project structure

This commit is contained in:
2026-08-19 23:25:08 +07:00
parent 05a93cfc09
commit a1fe31cf70
155 changed files with 3339 additions and 1007 deletions
@@ -0,0 +1,24 @@
using AutoMapper;
using MediatR;
using mws.backend.dotnet.application.Common;
namespace mws.backend.dotnet.application.MasterData;
public record CreateMasterDataCommand(SaveMasterDataRequest Request) : IRequest<MasterDataDto>;
public class CreateMasterDataHandler(IUnitOfWork uow, IMapper mapper) : IRequestHandler<CreateMasterDataCommand, MasterDataDto>
{
public async Task<MasterDataDto> Handle(CreateMasterDataCommand command, CancellationToken ct)
{
var entry = await MasterDataValidation.ValidateAsync(uow, command.Request, null, ct);
var now = DateTime.UtcNow;
entry.Id = Guid.NewGuid();
entry.CreatedAt = now;
entry.UpdatedAt = now;
uow.MasterData.Add(entry);
await uow.SaveChangesAsync(ct);
return mapper.Map<MasterDataDto>(entry);
}
}