DocSpace-client/common/ASC.Webhooks.Core/Dao/Models/WebhooksConfig.cs

57 lines
1.7 KiB
C#
Raw Normal View History

2021-08-19 09:11:26 +00:00
using ASC.Core.Common.EF;
using ASC.Core.Common.EF.Model;
using Microsoft.EntityFrameworkCore;
#nullable disable
2021-08-26 18:43:41 +00:00
namespace ASC.Webhooks.Core.Dao.Models
{
public partial class WebhooksConfig
{
2021-08-03 16:26:28 +00:00
public int ConfigId { get; set; }
public int TenantId { get; set; }
public string Uri { get; set; }
public string SecretKey { get; set; }
}
2021-08-19 09:11:26 +00:00
public static class WebhooksConfigExtension
{
public static ModelBuilderWrapper AddWebhooksConfig(this ModelBuilderWrapper modelBuilder)
{
modelBuilder
.Add(MySqlAddWebhooksConfig, Provider.MySql);
//.Add(PgSqlAddLoginEvents, Provider.Postgre);
return modelBuilder;
}
public static void MySqlAddWebhooksConfig(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<WebhooksConfig>(entity =>
{
entity.HasKey(e => new { e.ConfigId })
.HasName("PRIMARY");
entity.ToTable("webhooks_config");
entity.Property(e => e.ConfigId)
.HasColumnType("int")
2021-09-03 14:02:52 +00:00
.HasColumnName("config_id");
2021-08-19 09:11:26 +00:00
2021-09-03 14:02:52 +00:00
entity.Property(e => e.TenantId)
.HasColumnName("tenant_id")
.HasColumnType("int unsigned");
2021-08-19 09:11:26 +00:00
entity.Property(e => e.Uri)
.HasMaxLength(50)
2021-09-03 14:02:52 +00:00
.HasColumnName("uri")
2021-08-19 09:11:26 +00:00
.HasDefaultValueSql("''");
entity.Property(e => e.SecretKey)
.HasMaxLength(50)
2021-09-03 14:02:52 +00:00
.HasColumnName("secret_key")
2021-08-19 09:11:26 +00:00
.HasDefaultValueSql("''");
});
2021-10-19 16:53:28 +00:00
}
2021-08-19 09:11:26 +00:00
}
}