added log filter by eventId

This commit is contained in:
NikitaVashchuk 2023-04-12 16:35:15 +05:00
parent acff2c4439
commit 61533655d5
3 changed files with 9 additions and 3 deletions

View File

@ -175,7 +175,7 @@ public class DbWorker
return removeObj;
}
public IAsyncEnumerable<WebhooksLog> ReadJournal(int startIndex, int limit, DateTime? deliveryFrom, DateTime? deliveryTo, string hookUri, int? hookId, int? configId, WebhookGroupStatus? webhookGroupStatus)
public IAsyncEnumerable<WebhooksLog> ReadJournal(int startIndex, int limit, DateTime? deliveryFrom, DateTime? deliveryTo, string hookUri, int? hookId, int? configId, int? eventId, WebhookGroupStatus? webhookGroupStatus)
{
var webhooksDbContext = _dbContextFactory.CreateDbContext();
@ -210,7 +210,12 @@ public class DbWorker
q = q.Where(r => r.ConfigId == configId);
}
if(webhookGroupStatus != null)
if (eventId != null)
{
q = q.Where(r => r.Id == eventId);
}
if (webhookGroupStatus != null)
{
if ((webhookGroupStatus & WebhookGroupStatus.NotSent) != WebhookGroupStatus.NotSent)
{

View File

@ -112,7 +112,7 @@ public class WebhooksController : BaseSettingsController
var startIndex = Convert.ToInt32(_context.StartIndex);
var count = Convert.ToInt32(_context.Count);
await foreach (var j in _webhookDbWorker.ReadJournal(startIndex, count, model.DeliveryFrom, model.DeliveryTo, model.HookUri, model.WebhookId, model.ConfigId, model.GroupStatus))
await foreach (var j in _webhookDbWorker.ReadJournal(startIndex, count, model.DeliveryFrom, model.DeliveryTo, model.HookUri, model.WebhookId, model.ConfigId, model.EventId, model.GroupStatus))
{
yield return _mapper.Map<WebhooksLog, WebhooksLogDto>(j);
}

View File

@ -33,5 +33,6 @@ public class WebhooksLogRequest
public string HookUri { get; set; }
public int? WebhookId { get; set; }
public int? ConfigId { get; set; }
public int? EventId { get; set; }
public WebhookGroupStatus? GroupStatus { get; set; }
}