Webhook: format

This commit is contained in:
pavelbannov 2021-10-19 19:53:28 +03:00
parent 7d511385bc
commit ed8487e99f
7 changed files with 21 additions and 26 deletions

View File

@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using ASC.Common;
using ASC.Webhooks.Core;
@ -10,7 +9,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Primitives;
namespace ASC.Api.Core.Middleware
{
@ -28,7 +26,7 @@ namespace ASC.Api.Core.Middleware
var jsonOptions = new JsonOptions();
projectJsonOptions.Invoke(jsonOptions);
jsonSerializerOptions = jsonOptions.JsonSerializerOptions;
}
}
public override void OnResultExecuted(ResultExecutedContext context)
{

View File

@ -51,6 +51,6 @@ namespace ASC.Webhooks.Core.Dao.Models
.HasColumnName("secret_key")
.HasDefaultValueSql("''");
});
}
}
}
}

View File

@ -18,7 +18,7 @@ namespace ASC.Webhooks.Core.Dao.Models
public string RequestPayload { get; set; }
public string RequestHeaders { get; set; }
public string ResponsePayload { get; set; }
public string ResponseHeaders{ get; set; }
public string ResponseHeaders { get; set; }
public DateTime CreationTime { get; set; }
public string Event { get; set; }
public ProcessStatus Status { get; set; }
@ -29,9 +29,9 @@ namespace ASC.Webhooks.Core.Dao.Models
public static ModelBuilderWrapper AddWebhooksLog(this ModelBuilderWrapper modelBuilder)
{
modelBuilder
.Add(MySqlAddWebhooksLog, Provider.MySql);
//.Add(PgSqlAddUser, Provider.Postgre)
.Add(MySqlAddWebhooksLog, Provider.MySql);
//.Add(PgSqlAddUser, Provider.Postgre)
return modelBuilder;
}
@ -92,7 +92,7 @@ namespace ASC.Webhooks.Core.Dao.Models
.HasColumnType("varchar")
.HasColumnName("status")
.HasMaxLength(50);
});
});
}
}
}

View File

@ -1,12 +1,13 @@
using ASC.Core.Common.EF;
using ASC.Webhooks.Core.Dao.Models;
using Microsoft.EntityFrameworkCore;
using ASC.Core.Common.EF.Model;
using System;
using System.Collections.Generic;
using System;
using ASC.Core.Common.EF.Context;
using ASC.Common;
using ASC.Core.Common.EF;
using ASC.Core.Common.EF.Context;
using ASC.Core.Common.EF.Model;
using ASC.Webhooks.Core.Dao.Models;
using Microsoft.EntityFrameworkCore;
#nullable disable

View File

@ -1,9 +1,6 @@
using System.Collections.Generic;

using ASC.Common;
using Microsoft.Extensions.Primitives;
namespace ASC.Webhooks.Core
{
[Scope]

View File

@ -1,4 +1,5 @@
using System;
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

View File

@ -17,7 +17,6 @@ namespace ASC.Webhooks.Core
private DbWorker DbWorker { get; }
private TenantManager TenantManager { get; }
private ICacheNotify<WebhookRequest> WebhookNotify { get; }
private ILog Log { get; }
public WebhookPublisher(
DbWorker dbWorker,
@ -27,7 +26,6 @@ namespace ASC.Webhooks.Core
{
DbWorker = dbWorker;
TenantManager = tenantManager;
Log = options.Get("ASC.Webhooks.Core");
WebhookNotify = webhookNotify;
}
@ -39,12 +37,12 @@ namespace ASC.Webhooks.Core
foreach (var config in webhookConfigs)
{
var webhooksLog = new WebhooksLog
{
{
Uid = Guid.NewGuid().ToString(),
TenantId = tenantId,
Event = eventName,
CreationTime = DateTime.UtcNow,
RequestPayload = requestPayload,
RequestPayload = requestPayload,
Status = ProcessStatus.InProcess,
ConfigId = config.ConfigId
};