[Add] MasterData Services.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Subdistricts;
|
||||
|
||||
public sealed class GetSubdistrictUseCase : IGetSubdistrictUseCase
|
||||
{
|
||||
private readonly ISubdistrictRepository _repo;
|
||||
|
||||
public GetSubdistrictUseCase(ISubdistrictRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<SubdistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) return null;
|
||||
|
||||
return new SubdistrictResponse(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.Postcode,
|
||||
e.DistrictId,
|
||||
e.District.Name,
|
||||
e.District.Code,
|
||||
e.District.ProvinceId,
|
||||
e.District.Province.Name,
|
||||
e.District.Province.Code
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user