Files
amrez-nova-eop-services-api/AMREZ.EOP.Application/UseCases/MasterData/Allergen/GetAllergenUseCase.cs
Thanakarn Klangkasame 1e636aa3d5 [Add] MasterData Services.
2025-11-26 10:29:56 +07:00

17 lines
731 B
C#

using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
public class GetAllergenUseCase : IGetAllergenUseCase
{
private readonly IAllergenRepository _repo;
public GetAllergenUseCase(IAllergenRepository repo) => _repo = repo;
public async Task<AllergenResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
{
var e = await _repo.GetAsync(id, ct);
return e is null ? null : new AllergenResponse(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
}
}