Webhook: format
This commit is contained in:
parent
7d511385bc
commit
ed8487e99f
@ -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)
|
||||
{
|
||||
|
@ -51,6 +51,6 @@ namespace ASC.Webhooks.Core.Dao.Models
|
||||
.HasColumnName("secret_key")
|
||||
.HasDefaultValueSql("''");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
using ASC.Common;
|
||||
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
namespace ASC.Webhooks.Core
|
||||
{
|
||||
[Scope]
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user