Browse Source

feat: reset secret to not required

pull/555/head
cKey 4 years ago
parent
commit
e2b76365d0
  1. 2
      apps/vue/src/hooks/abp/useValidation.ts
  2. 21
      apps/vue/src/views/webhooks/send-attempts/components/SendAttemptModal.vue
  3. 38
      apps/vue/src/views/webhooks/subscriptions/components/SubscriptionModal.vue
  4. 9
      aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/AbpUINavigationVueVbenAdminNavigationDefinitionProvider.cs
  5. 2
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookManager.cs
  6. 9
      aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/System/AbpStringCryptographyExtensions.cs
  7. 1
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs
  8. 7
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs
  9. 6
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs
  10. 2
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs
  11. 3
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs
  12. 162
      aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220409053632_Reset-Field-Secret-To-Not-Required.Designer.cs
  13. 47
      aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220409053632_Reset-Field-Secret-To-Not-Required.cs
  14. 7
      aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs

2
apps/vue/src/hooks/abp/useValidation.ts

@ -151,7 +151,7 @@ export function useValidation() {
: L(notNameEnum, field.length); : L(notNameEnum, field.length);
function checkLength(value: string | any[]) { function checkLength(value: string | any[]) {
return checkMaximum ? value.length > field.length : value.length < field.length; return checkMaximum ? field.length > value.length : value.length > field.length;
} }
return { return {

21
apps/vue/src/views/webhooks/send-attempts/components/SendAttemptModal.vue

@ -16,6 +16,9 @@
> >
<Tabs v-model:activeKey="activeKey"> <Tabs v-model:activeKey="activeKey">
<TabPane key="basic" :tab="L('BasicInfo')"> <TabPane key="basic" :tab="L('BasicInfo')">
<FormItem :label="L('DisplayName:TenantId')">
<Input readonly :value="modelRef.tenantId" />
</FormItem>
<FormItem :label="L('DisplayName:CreationTime')"> <FormItem :label="L('DisplayName:CreationTime')">
<Input readonly :value="getDateTime(modelRef.creationTime)" /> <Input readonly :value="getDateTime(modelRef.creationTime)" />
</FormItem> </FormItem>
@ -23,11 +26,14 @@
<Tag v-if="modelRef.responseStatusCode" :color="getHttpStatusColor(modelRef.responseStatusCode)">{{ httpStatusCodeMap[modelRef.responseStatusCode] }}</Tag> <Tag v-if="modelRef.responseStatusCode" :color="getHttpStatusColor(modelRef.responseStatusCode)">{{ httpStatusCodeMap[modelRef.responseStatusCode] }}</Tag>
</FormItem> </FormItem>
<FormItem :label="L('DisplayName:Response')"> <FormItem :label="L('DisplayName:Response')">
<CodeEditor readonly style="height: 300px;" :mode="MODE.HTML" v-model:value="modelRef.response" /> <Textarea readonly v-model:value="modelRef.response" :auto-size="{ minRows: 10 }" />
</FormItem> </FormItem>
</TabPane> </TabPane>
<TabPane v-if="modelRef.webhookEvent" key="event" :tab="L('WebhookEvent')"> <TabPane v-if="modelRef.webhookEvent" key="event" :tab="L('WebhookEvent')">
<FormItem :label="L('DisplayName:TenantId')">
<Input readonly :value="modelRef.webhookEvent.tenantId" />
</FormItem>
<FormItem :label="L('DisplayName:WebhookEventId')"> <FormItem :label="L('DisplayName:WebhookEventId')">
<Input readonly :value="modelRef.webhookEventId" /> <Input readonly :value="modelRef.webhookEventId" />
</FormItem> </FormItem>
@ -43,17 +49,20 @@
</TabPane> </TabPane>
<TabPane v-if="subscriptionRef.id" key="subscription" :tab="L('Subscriptions')"> <TabPane v-if="subscriptionRef.id" key="subscription" :tab="L('Subscriptions')">
<FormItem :label="L('DisplayName:WebhookSubscriptionId')">
<Input readonly :value="modelRef.webhookSubscriptionId" />
</FormItem>
<FormItem :label="L('DisplayName:IsActive')"> <FormItem :label="L('DisplayName:IsActive')">
<Checkbox disabled v-model:checked="subscriptionRef.isActive">{{ L('DisplayName:IsActive') }}</Checkbox> <Checkbox disabled v-model:checked="subscriptionRef.isActive">{{ L('DisplayName:IsActive') }}</Checkbox>
</FormItem> </FormItem>
<FormItem :label="L('DisplayName:TenantId')">
<Input readonly :value="subscriptionRef.tenantId" />
</FormItem>
<FormItem :label="L('DisplayName:WebhookSubscriptionId')">
<Input readonly :value="modelRef.webhookSubscriptionId" />
</FormItem>
<FormItem :label="L('DisplayName:WebhookUri')"> <FormItem :label="L('DisplayName:WebhookUri')">
<Input readonly :value="subscriptionRef.webhookUri" /> <Input readonly :value="subscriptionRef.webhookUri" />
</FormItem> </FormItem>
<FormItem :label="L('DisplayName:Secret')"> <FormItem :label="L('DisplayName:Secret')">
<Input readonly :value="subscriptionRef.secret" /> <InputPassword readonly :value="subscriptionRef.secret" />
</FormItem> </FormItem>
<FormItem :label="L('DisplayName:CreationTime')"> <FormItem :label="L('DisplayName:CreationTime')">
<Input readonly :value="getDateTime(subscriptionRef.creationTime)" /> <Input readonly :value="getDateTime(subscriptionRef.creationTime)" />
@ -79,6 +88,8 @@
Tabs, Tabs,
Tag, Tag,
Input, Input,
Textarea,
InputPassword
} from 'ant-design-vue'; } from 'ant-design-vue';
import { CodeEditor, MODE } from '/@/components/CodeEditor'; import { CodeEditor, MODE } from '/@/components/CodeEditor';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';

38
apps/vue/src/views/webhooks/subscriptions/components/SubscriptionModal.vue

@ -17,6 +17,9 @@
:model="modelRef" :model="modelRef"
:rules="modelRules" :rules="modelRules"
> >
<FormItem name="isActive" :label="L('DisplayName:IsActive')">
<Checkbox v-model:checked="modelRef.isActive">{{ L('DisplayName:IsActive') }}</Checkbox>
</FormItem>
<FormItem name="tenantId" :label="L('DisplayName:TenantId')"> <FormItem name="tenantId" :label="L('DisplayName:TenantId')">
<Select v-model:value="modelRef.tenantId"> <Select v-model:value="modelRef.tenantId">
<SelectOption <SelectOption
@ -26,14 +29,11 @@
>{{ tenant.name }}</SelectOption> >{{ tenant.name }}</SelectOption>
</Select> </Select>
</FormItem> </FormItem>
<FormItem name="isActive" :label="L('DisplayName:IsActive')">
<Checkbox v-model:checked="modelRef.isActive">{{ L('DisplayName:IsActive') }}</Checkbox>
</FormItem>
<FormItem name="webhookUri" required :label="L('DisplayName:WebhookUri')"> <FormItem name="webhookUri" required :label="L('DisplayName:WebhookUri')">
<Input v-model:value="modelRef.webhookUri" autocomplete="off" /> <Input v-model:value="modelRef.webhookUri" autocomplete="off" />
</FormItem> </FormItem>
<FormItem name="secret" required :label="L('DisplayName:Secret')"> <FormItem name="secret" :label="L('DisplayName:Secret')">
<Input v-model:value="modelRef.secret" autocomplete="off" /> <InputPassword v-model:value="modelRef.secret" autocomplete="off" />
</FormItem> </FormItem>
<FormItem name="webhooks" :label="L('DisplayName:Webhooks')"> <FormItem name="webhooks" :label="L('DisplayName:Webhooks')">
<Select v-model:value="modelRef.webhooks" mode="multiple"> <Select v-model:value="modelRef.webhooks" mode="multiple">
@ -63,7 +63,9 @@
Form, Form,
Select, Select,
Input, Input,
InputPassword
} from 'ant-design-vue'; } from 'ant-design-vue';
import { isString } from '/@/utils/is';
import { CodeEditor, MODE } from '/@/components/CodeEditor'; import { CodeEditor, MODE } from '/@/components/CodeEditor';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import { Tenant } from '/@/api/saas/model/tenantModel'; import { Tenant } from '/@/api/saas/model/tenantModel';
@ -103,15 +105,26 @@
return L('Subscriptions:Edit'); return L('Subscriptions:Edit');
}); });
const modelRules = reactive({ const modelRules = reactive({
webhookUri: ruleCreator.fieldRequired({ webhookUri: [
name: 'WebhookUri', ...ruleCreator.fieldRequired({
resourceName: 'WebhooksManagement', name: 'WebhookUri',
prefix: 'DisplayName', resourceName: 'WebhooksManagement',
}), prefix: 'DisplayName',
secret: ruleCreator.fieldRequired({ }),
...ruleCreator.fieldMustBeStringWithMaximumLength({
name: 'WebhookUri',
resourceName: 'WebhooksManagement',
prefix: 'DisplayName',
length: 255,
type: 'string',
})
],
secret: ruleCreator.fieldMustBeStringWithMaximumLength({
name: 'Secret', name: 'Secret',
resourceName: 'WebhooksManagement', resourceName: 'WebhooksManagement',
prefix: 'DisplayName', prefix: 'DisplayName',
length: 128,
type: 'string',
}), }),
}); });
@ -151,6 +164,9 @@
formEl?.validate().then(() => { formEl?.validate().then(() => {
changeOkLoading(true); changeOkLoading(true);
const model = unref(modelRef); const model = unref(modelRef);
if (isString(model.headers)) {
model.headers = JSON.parse(model.headers)
}
const api = isEditModal.value const api = isEditModal.value
? update(model.id, Object.assign(model)) ? update(model.id, Object.assign(model))
: create(Object.assign(model)); : create(Object.assign(model));

9
aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/AbpUINavigationVueVbenAdminNavigationDefinitionProvider.cs

@ -410,21 +410,24 @@ namespace LINGYUN.Abp.UI.Navigation.VueVbenAdmin
url: "/webhooks", url: "/webhooks",
component: "", component: "",
description: "WebHooks", description: "WebHooks",
icon: "ic:outline-webhook"); icon: "ic:outline-webhook",
multiTenancySides: MultiTenancySides.Host);
webhooks.AddItem( webhooks.AddItem(
new ApplicationMenu( new ApplicationMenu(
name: "Subscriptions", name: "Subscriptions",
displayName: "管理订阅", displayName: "管理订阅",
url: "/webhooks/subscriptions", url: "/webhooks/subscriptions",
component: "/webhooks/subscriptions/index", component: "/webhooks/subscriptions/index",
description: "管理订阅")); description: "管理订阅"),
multiTenancySides: MultiTenancySides.Host);
webhooks.AddItem( webhooks.AddItem(
new ApplicationMenu( new ApplicationMenu(
name: "SendAttempts", name: "SendAttempts",
displayName: "管理记录", displayName: "管理记录",
url: "/webhooks/send-attempts", url: "/webhooks/send-attempts",
component: "/webhooks/send-attempts/index", component: "/webhooks/send-attempts/index",
description: "管理记录")); description: "管理记录"),
multiTenancySides: MultiTenancySides.Host);
return new NavigationDefinition(webhooks); return new NavigationDefinition(webhooks);
} }

2
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/LINGYUN/Abp/Webhooks/WebhookManager.cs

@ -23,7 +23,7 @@ namespace LINGYUN.Abp.Webhooks
public virtual async Task<WebhookPayload> GetWebhookPayloadAsync(WebhookSenderArgs webhookSenderArgs) public virtual async Task<WebhookPayload> GetWebhookPayloadAsync(WebhookSenderArgs webhookSenderArgs)
{ {
var data = JsonConvert.SerializeObject(webhookSenderArgs.Data); var data = JsonConvert.DeserializeObject(webhookSenderArgs.Data);
var attemptNumber = await WebhookSendAttemptStore.GetSendAttemptCountAsync( var attemptNumber = await WebhookSendAttemptStore.GetSendAttemptCountAsync(
webhookSenderArgs.TenantId, webhookSenderArgs.TenantId,

9
aspnet-core/modules/webhooks/LINGYUN.Abp.Webhooks/System/AbpStringCryptographyExtensions.cs

@ -1,4 +1,5 @@
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text;
namespace System; namespace System;
@ -8,6 +9,12 @@ internal static class AbpStringCryptographyExtensions
{ {
var data = planText.GetBytes(); var data = planText.GetBytes();
using var hmacsha256 = new HMACSHA256(salt); using var hmacsha256 = new HMACSHA256(salt);
return BitConverter.ToString(hmacsha256.ComputeHash(data)); var retVal = hmacsha256.ComputeHash(data);
var sb = new StringBuilder();
for (var i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("x2"));
}
return sb.ToString();
} }
} }

1
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionCreateOrUpdateInput.cs

@ -20,7 +20,6 @@ public abstract class WebhookSubscriptionCreateOrUpdateInput
[DynamicStringLength(typeof(WebhookSubscriptionConsts), nameof(WebhookSubscriptionConsts.MaxWebhookUriLength))] [DynamicStringLength(typeof(WebhookSubscriptionConsts), nameof(WebhookSubscriptionConsts.MaxWebhookUriLength))]
public string WebhookUri { get; set; } public string WebhookUri { get; set; }
[Required]
[DynamicStringLength(typeof(WebhookSubscriptionConsts), nameof(WebhookSubscriptionConsts.MaxSecretLength))] [DynamicStringLength(typeof(WebhookSubscriptionConsts), nameof(WebhookSubscriptionConsts.MaxSecretLength))]
public string Secret { get; set; } public string Secret { get; set; }

7
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs

@ -34,10 +34,13 @@ public class WebhookSubscriptionAppService : WebhooksManagementAppServiceBase, I
var subscription = new WebhookSubscription( var subscription = new WebhookSubscription(
GuidGenerator.Create(), GuidGenerator.Create(),
input.WebhookUri, input.WebhookUri,
input.Secret,
JsonConvert.SerializeObject(input.Webhooks), JsonConvert.SerializeObject(input.Webhooks),
JsonConvert.SerializeObject(input.Headers), JsonConvert.SerializeObject(input.Headers),
CurrentTenant.Id); input.Secret,
CurrentTenant.Id)
{
IsActive = input.IsActive,
};
await SubscriptionRepository.InsertAsync(subscription); await SubscriptionRepository.InsertAsync(subscription);

6
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscription.cs

@ -18,15 +18,15 @@ public class WebhookSubscription : CreationAuditedEntity<Guid>
public WebhookSubscription( public WebhookSubscription(
Guid id, Guid id,
string webhookUri, string webhookUri,
string secret,
string webhooks, string webhooks,
string headers, string headers,
string secret = null,
Guid? tenantId = null) : base(id) Guid? tenantId = null) : base(id)
{ {
SetSecret(secret);
SetWebhookUri(webhookUri); SetWebhookUri(webhookUri);
SetWebhooks(webhooks); SetWebhooks(webhooks);
SetHeaders(headers); SetHeaders(headers);
SetSecret(secret);
TenantId = tenantId; TenantId = tenantId;
IsActive = true; IsActive = true;
@ -34,7 +34,7 @@ public class WebhookSubscription : CreationAuditedEntity<Guid>
public void SetSecret(string secret) public void SetSecret(string secret)
{ {
Secret = Check.NotNullOrWhiteSpace(secret, nameof(secret), WebhookSubscriptionConsts.MaxSecretLength); Secret = Check.Length(secret, nameof(secret), WebhookSubscriptionConsts.MaxSecretLength);
} }
public void SetWebhookUri(string webhookUri) public void SetWebhookUri(string webhookUri)

2
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionsStore.cs

@ -112,9 +112,9 @@ public class WebhookSubscriptionsStore : DomainService, IWebhookSubscriptionsSto
var subscription = new WebhookSubscription( var subscription = new WebhookSubscription(
webhookSubscription.Id, webhookSubscription.Id,
webhookSubscription.WebhookUri, webhookSubscription.WebhookUri,
webhookSubscription.Secret,
JsonConvert.SerializeObject(webhookSubscription.Webhooks), JsonConvert.SerializeObject(webhookSubscription.Webhooks),
JsonConvert.SerializeObject(webhookSubscription.Headers), JsonConvert.SerializeObject(webhookSubscription.Headers),
webhookSubscription.Secret,
webhookSubscription.TenantId); webhookSubscription.TenantId);
await SubscriptionRepository.InsertAsync(subscription); await SubscriptionRepository.InsertAsync(subscription);

3
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/WebhooksManagementDbContextModelCreatingExtensions.cs

@ -61,11 +61,10 @@ public static class WebhooksManagementDbContextModelCreatingExtensions
.IsRequired() .IsRequired()
.HasColumnName(nameof(WebhookSubscription.WebhookUri)) .HasColumnName(nameof(WebhookSubscription.WebhookUri))
.HasMaxLength(WebhookSubscriptionConsts.MaxWebhookUriLength); .HasMaxLength(WebhookSubscriptionConsts.MaxWebhookUriLength);
b.Property(p => p.Secret) b.Property(p => p.Secret)
.IsRequired()
.HasColumnName(nameof(WebhookSubscription.Secret)) .HasColumnName(nameof(WebhookSubscription.Secret))
.HasMaxLength(WebhookSubscriptionConsts.MaxSecretLength); .HasMaxLength(WebhookSubscriptionConsts.MaxSecretLength);
b.Property(p => p.Webhooks) b.Property(p => p.Webhooks)
.HasColumnName(nameof(WebhookSubscription.Webhooks)) .HasColumnName(nameof(WebhookSubscription.Webhooks))
.HasMaxLength(WebhookSubscriptionConsts.MaxWebhooksLength); .HasMaxLength(WebhookSubscriptionConsts.MaxWebhooksLength);

162
aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220409053632_Reset-Field-Secret-To-Not-Required.Designer.cs

@ -0,0 +1,162 @@
// <auto-generated />
using System;
using LY.MicroService.WebhooksManagement.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.WebhooksManagement.Migrations
{
[DbContext(typeof(WebhooksManagementMigrationsDbContext))]
[Migration("20220409053632_Reset-Field-Secret-To-Not-Required")]
partial class ResetFieldSecretToNotRequired
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "6.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<string>("Data")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Data");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("WebhookName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("WebhookName");
b.HasKey("Id");
b.ToTable("AbpWebhooksEvents", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<string>("Response")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Response");
b.Property<int?>("ResponseStatusCode")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<Guid>("WebhookEventId")
.HasColumnType("char(36)");
b.Property<Guid>("WebhookSubscriptionId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("WebhookEventId");
b.ToTable("AbpWebhooksSendAttempts", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSubscription", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Headers")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Headers");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Secret")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Secret");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("WebhookUri")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)")
.HasColumnName("WebhookUri");
b.Property<string>("Webhooks")
.HasMaxLength(2147483647)
.HasColumnType("longtext")
.HasColumnName("Webhooks");
b.HasKey("Id");
b.ToTable("AbpWebhooksSubscriptions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b =>
{
b.HasOne("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", "WebhookEvent")
.WithOne()
.HasForeignKey("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", "WebhookEventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WebhookEvent");
});
#pragma warning restore 612, 618
}
}
}

47
aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/20220409053632_Reset-Field-Secret-To-Not-Required.cs

@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.WebhooksManagement.Migrations
{
public partial class ResetFieldSecretToNotRequired : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Secret",
table: "AbpWebhooksSubscriptions",
type: "varchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AbpWebhooksSubscriptions",
keyColumn: "Secret",
keyValue: null,
column: "Secret",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Secret",
table: "AbpWebhooksSubscriptions",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

7
aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/Migrations/WebhooksManagementMigrationsDbContextModelSnapshot.cs

@ -47,8 +47,7 @@ namespace LY.MicroService.WebhooksManagement.Migrations
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("char(36)") .HasColumnType("char(36)");
.HasColumnName("TenantId");
b.Property<string>("WebhookName") b.Property<string>("WebhookName")
.IsRequired() .IsRequired()
@ -84,8 +83,7 @@ namespace LY.MicroService.WebhooksManagement.Migrations
.HasColumnType("int"); .HasColumnType("int");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("char(36)") .HasColumnType("char(36)");
.HasColumnName("TenantId");
b.Property<Guid>("WebhookEventId") b.Property<Guid>("WebhookEventId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
@ -123,7 +121,6 @@ namespace LY.MicroService.WebhooksManagement.Migrations
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
b.Property<string>("Secret") b.Property<string>("Secret")
.IsRequired()
.HasMaxLength(128) .HasMaxLength(128)
.HasColumnType("varchar(128)") .HasColumnType("varchar(128)")
.HasColumnName("Secret"); .HasColumnName("Secret");

Loading…
Cancel
Save