using System.Diagnostics; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.FastEndPoint; using MMBLL.EventLog; using MMBLL.Item; using MMDAL.DTO.EventLog; using MMDAL.DTO.Item; using Newtonsoft.Json; namespace MMSL.EndPoints.EventLog { public sealed class GetEventLog : StreamingEndPoint { private readonly IEventLogBLL _eventlogBLL; private readonly ILogger _logger; public GetEventLog(IEventLogBLL IEventLogBLL, ILogger Logger) { _eventlogBLL = IEventLogBLL; _logger = Logger; } public override void Configure() { Get("/GetEventLogAsync"); AllowAnonymous(); } public record GetEventLogParameters([property: FromHeader] string Login); protected override IAsyncEnumerable GetStreamDataAsync(GetEventLogParameters req, CancellationToken ct) { LoginDTO? loginDTO = JsonConvert.DeserializeObject(req.Login); return _eventlogBLL.GetEventLogAsync(loginDTO!, ct); } } }