committed by
GitHub
70 changed files with 26305 additions and 219 deletions
@ -0,0 +1,812 @@ |
|||||
|
// <auto-generated />
|
||||
|
using System; |
||||
|
using LINGYUN.Abp.MicroService.MessageService; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LINGYUN.Abp.MicroService.MessageService.Migrations |
||||
|
{ |
||||
|
[DbContext(typeof(MessageServiceMigrationsDbContext))] |
||||
|
[Migration("20260320092811_Add-Notification-Send-Record")] |
||||
|
partial class AddNotificationSendRecord |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
||||
|
{ |
||||
|
#pragma warning disable 612, 618
|
||||
|
modelBuilder |
||||
|
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) |
||||
|
.HasAnnotation("ProductVersion", "10.0.0") |
||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
||||
|
|
||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<int>("Age") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<string>("AvatarUrl") |
||||
|
.HasMaxLength(512) |
||||
|
.HasColumnType("character varying(512)"); |
||||
|
|
||||
|
b.Property<DateTime?>("Birthday") |
||||
|
.HasColumnType("timestamp with time zone"); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp") |
||||
|
.IsConcurrencyToken() |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(40) |
||||
|
.HasColumnType("character varying(40)") |
||||
|
.HasColumnName("ConcurrencyStamp"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("Description") |
||||
|
.HasMaxLength(50) |
||||
|
.HasColumnType("character varying(50)"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.IsRequired() |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<DateTime?>("LastModificationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("LastModificationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("LastModifierId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("LastModifierId"); |
||||
|
|
||||
|
b.Property<DateTime?>("LastOnlineTime") |
||||
|
.HasColumnType("timestamp with time zone"); |
||||
|
|
||||
|
b.Property<string>("NickName") |
||||
|
.HasMaxLength(256) |
||||
|
.HasColumnType("character varying(256)"); |
||||
|
|
||||
|
b.Property<int>("Sex") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<string>("Sign") |
||||
|
.HasMaxLength(30) |
||||
|
.HasColumnType("character varying(30)"); |
||||
|
|
||||
|
b.Property<int>("State") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<string>("UserName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(256) |
||||
|
.HasColumnType("character varying(256)"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId"); |
||||
|
|
||||
|
b.ToTable("AppUserChatCards", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<bool>("Black") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp") |
||||
|
.IsConcurrencyToken() |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(40) |
||||
|
.HasColumnType("character varying(40)") |
||||
|
.HasColumnName("ConcurrencyStamp"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("Description") |
||||
|
.HasMaxLength(50) |
||||
|
.HasColumnType("character varying(50)"); |
||||
|
|
||||
|
b.Property<bool>("DontDisturb") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.IsRequired() |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<Guid>("FrientId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<bool>("IsStatic") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<string>("RemarkName") |
||||
|
.HasMaxLength(256) |
||||
|
.HasColumnType("character varying(256)"); |
||||
|
|
||||
|
b.Property<bool>("SpecialFocus") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<byte>("Status") |
||||
|
.HasColumnType("smallint"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId", "FrientId"); |
||||
|
|
||||
|
b.ToTable("AppUserChatFriends", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<bool>("AllowAddFriend") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<bool>("AllowAnonymous") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<bool>("AllowReceiveMessage") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<bool>("AllowSendMessage") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<bool>("RequireAddFriendValition") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId"); |
||||
|
|
||||
|
b.ToTable("AppUserChatSettings", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp") |
||||
|
.IsConcurrencyToken() |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(40) |
||||
|
.HasColumnType("character varying(40)") |
||||
|
.HasColumnName("ConcurrencyStamp"); |
||||
|
|
||||
|
b.Property<string>("Content") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(1048576) |
||||
|
.HasColumnType("character varying(1048576)"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.IsRequired() |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<long>("MessageId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<Guid>("ReceiveUserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<string>("SendUserName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(64) |
||||
|
.HasColumnType("character varying(64)"); |
||||
|
|
||||
|
b.Property<int>("Source") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<short>("State") |
||||
|
.HasColumnType("smallint"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<int>("Type") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "ReceiveUserId"); |
||||
|
|
||||
|
b.ToTable("AppUserMessages", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<string>("Address") |
||||
|
.HasMaxLength(256) |
||||
|
.HasColumnType("character varying(256)"); |
||||
|
|
||||
|
b.Property<Guid>("AdminUserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<bool>("AllowAnonymous") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<bool>("AllowSendMessage") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<string>("AvatarUrl") |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("character varying(128)"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("Description") |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("character varying(128)"); |
||||
|
|
||||
|
b.Property<long>("GroupId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<DateTime?>("LastModificationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("LastModificationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("LastModifierId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("LastModifierId"); |
||||
|
|
||||
|
b.Property<int>("MaxUserCount") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<string>("Name") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(20) |
||||
|
.HasColumnType("character varying(20)"); |
||||
|
|
||||
|
b.Property<string>("Notice") |
||||
|
.HasMaxLength(64) |
||||
|
.HasColumnType("character varying(64)"); |
||||
|
|
||||
|
b.Property<string>("Tag") |
||||
|
.HasMaxLength(512) |
||||
|
.HasColumnType("character varying(512)"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "Name"); |
||||
|
|
||||
|
b.ToTable("AppChatGroups", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<long>("GroupId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<Guid>("ShieldUserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "GroupId"); |
||||
|
|
||||
|
b.ToTable("AppGroupChatBlacks", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp") |
||||
|
.IsConcurrencyToken() |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(40) |
||||
|
.HasColumnType("character varying(40)") |
||||
|
.HasColumnName("ConcurrencyStamp"); |
||||
|
|
||||
|
b.Property<string>("Content") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(1048576) |
||||
|
.HasColumnType("character varying(1048576)"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.IsRequired() |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<long>("GroupId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<long>("MessageId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<string>("SendUserName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(64) |
||||
|
.HasColumnType("character varying(64)"); |
||||
|
|
||||
|
b.Property<int>("Source") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<short>("State") |
||||
|
.HasColumnType("smallint"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<int>("Type") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "GroupId"); |
||||
|
|
||||
|
b.ToTable("AppGroupMessages", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<long>("GroupId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "GroupId", "UserId"); |
||||
|
|
||||
|
b.ToTable("AppUserChatGroups", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<string>("ConcurrencyStamp") |
||||
|
.IsConcurrencyToken() |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(40) |
||||
|
.HasColumnType("character varying(40)") |
||||
|
.HasColumnName("ConcurrencyStamp"); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("CreatorId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("CreatorId"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.IsRequired() |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<bool>("IsAdmin") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<DateTime?>("LastModificationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("LastModificationTime"); |
||||
|
|
||||
|
b.Property<Guid?>("LastModifierId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("LastModifierId"); |
||||
|
|
||||
|
b.Property<string>("NickName") |
||||
|
.HasMaxLength(256) |
||||
|
.HasColumnType("character varying(256)"); |
||||
|
|
||||
|
b.Property<DateTime?>("SilenceEnd") |
||||
|
.HasColumnType("timestamp with time zone"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId"); |
||||
|
|
||||
|
b.ToTable("AppUserGroupCards", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.Notification", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<int>("ContentType") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("integer") |
||||
|
.HasDefaultValue(0); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<DateTime?>("ExpirationTime") |
||||
|
.HasColumnType("timestamp with time zone"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<long>("NotificationId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<string>("NotificationName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("NotificationTypeName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(512) |
||||
|
.HasColumnType("character varying(512)"); |
||||
|
|
||||
|
b.Property<short>("Severity") |
||||
|
.HasColumnType("smallint"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<int>("Type") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "NotificationName"); |
||||
|
|
||||
|
b.ToTable("AppNotifications", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.NotificationDefinitionGroupRecord", b => |
||||
|
{ |
||||
|
b.Property<Guid>("Id") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<bool>("AllowSubscriptionToClients") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<string>("Description") |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("DisplayName") |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<string>("Name") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.ToTable("AppNotificationDefinitionGroups", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.NotificationDefinitionRecord", b => |
||||
|
{ |
||||
|
b.Property<Guid>("Id") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<bool>("AllowSubscriptionToClients") |
||||
|
.HasColumnType("boolean"); |
||||
|
|
||||
|
b.Property<int>("ContentType") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("integer") |
||||
|
.HasDefaultValue(0); |
||||
|
|
||||
|
b.Property<string>("Description") |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("DisplayName") |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("ExtraProperties") |
||||
|
.HasColumnType("text") |
||||
|
.HasColumnName("ExtraProperties"); |
||||
|
|
||||
|
b.Property<string>("GroupName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("Name") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<int>("NotificationLifetime") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<int>("NotificationType") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<string>("Providers") |
||||
|
.HasMaxLength(200) |
||||
|
.HasColumnType("character varying(200)"); |
||||
|
|
||||
|
b.Property<string>("Template") |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("character varying(128)"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.ToTable("AppNotificationDefinitions", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.NotificationSendRecord", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<long>("NotificationId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<string>("NotificationName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<string>("Provider") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(50) |
||||
|
.HasColumnType("character varying(50)"); |
||||
|
|
||||
|
b.Property<string>("Reason") |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<DateTime>("SendTime") |
||||
|
.HasColumnType("timestamp with time zone"); |
||||
|
|
||||
|
b.Property<int>("State") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<string>("UserName") |
||||
|
.IsRequired() |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("character varying(128)") |
||||
|
.HasDefaultValue("/"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "NotificationName") |
||||
|
.HasDatabaseName("IX_Tenant_Send_Notification_Name"); |
||||
|
|
||||
|
b.ToTable("AppNotificationSendRecords", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.UserNotification", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<long>("NotificationId") |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
b.Property<int>("ReadStatus") |
||||
|
.HasColumnType("integer"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId", "NotificationId") |
||||
|
.HasDatabaseName("IX_Tenant_User_Notification_Id"); |
||||
|
|
||||
|
b.ToTable("AppUserNotifications", (string)null); |
||||
|
}); |
||||
|
|
||||
|
modelBuilder.Entity("LINGYUN.Abp.Notifications.UserSubscribe", b => |
||||
|
{ |
||||
|
b.Property<long>("Id") |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasColumnType("bigint"); |
||||
|
|
||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id")); |
||||
|
|
||||
|
b.Property<DateTime>("CreationTime") |
||||
|
.HasColumnType("timestamp with time zone") |
||||
|
.HasColumnName("CreationTime"); |
||||
|
|
||||
|
b.Property<string>("NotificationName") |
||||
|
.IsRequired() |
||||
|
.HasMaxLength(255) |
||||
|
.HasColumnType("character varying(255)"); |
||||
|
|
||||
|
b.Property<Guid?>("TenantId") |
||||
|
.HasColumnType("uuid") |
||||
|
.HasColumnName("TenantId"); |
||||
|
|
||||
|
b.Property<Guid>("UserId") |
||||
|
.HasColumnType("uuid"); |
||||
|
|
||||
|
b.Property<string>("UserName") |
||||
|
.IsRequired() |
||||
|
.ValueGeneratedOnAdd() |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("character varying(128)") |
||||
|
.HasDefaultValue("/"); |
||||
|
|
||||
|
b.HasKey("Id"); |
||||
|
|
||||
|
b.HasIndex("TenantId", "UserId", "NotificationName") |
||||
|
.IsUnique() |
||||
|
.HasDatabaseName("IX_Tenant_User_Notification_Name"); |
||||
|
|
||||
|
b.ToTable("AppUserSubscribes", (string)null); |
||||
|
}); |
||||
|
#pragma warning restore 612, 618
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LINGYUN.Abp.MicroService.MessageService.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class AddNotificationSendRecord : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AppNotificationSendRecords", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<long>(type: "bigint", nullable: false) |
||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |
||||
|
TenantId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
Provider = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
||||
|
SendTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
UserName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, defaultValue: "/"), |
||||
|
NotificationId = table.Column<long>(type: "bigint", nullable: false), |
||||
|
NotificationName = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false), |
||||
|
State = table.Column<int>(type: "integer", nullable: false), |
||||
|
Reason = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AppNotificationSendRecords", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_Tenant_Send_Notification_Name", |
||||
|
table: "AppNotificationSendRecords", |
||||
|
columns: new[] { "TenantId", "NotificationName" }); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AppNotificationSendRecords"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,150 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class AddAIManagementModule : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAIConversations", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
||||
|
Workspace = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false), |
||||
|
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
ExpiredAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
UpdateAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uuid", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAIConversations", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAITextChatMessages", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
Content = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "text", nullable: false), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
TenantId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
Workspace = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false), |
||||
|
Role = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false), |
||||
|
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
ConversationId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
ReplyMessage = table.Column<string>(type: "text", nullable: true), |
||||
|
ReplyAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAITextChatMessages", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAITokenUsages", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
MessageId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
ConversationId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
InputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
OutputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
TotalTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
CachedInputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
ReasoningTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uuid", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAITokenUsages", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAIWorkspaceDefinitions", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false), |
||||
|
Provider = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false), |
||||
|
ModelName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false), |
||||
|
DisplayName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false), |
||||
|
Description = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true), |
||||
|
ApiKey = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true), |
||||
|
ApiBaseUrl = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true), |
||||
|
SystemPrompt = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true), |
||||
|
Instructions = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true), |
||||
|
Temperature = table.Column<float>(type: "real", nullable: true), |
||||
|
MaxOutputTokens = table.Column<int>(type: "integer", nullable: true), |
||||
|
FrequencyPenalty = table.Column<float>(type: "real", nullable: true), |
||||
|
PresencePenalty = table.Column<float>(type: "real", nullable: true), |
||||
|
IsEnabled = table.Column<bool>(type: "boolean", nullable: false), |
||||
|
IsSystem = table.Column<bool>(type: "boolean", nullable: false), |
||||
|
StateCheckers = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "text", nullable: false), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uuid", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAIWorkspaceDefinitions", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAITextChatMessages_TenantId_ConversationId", |
||||
|
table: "AbpAITextChatMessages", |
||||
|
columns: new[] { "TenantId", "ConversationId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAITokenUsages_TenantId_ConversationId", |
||||
|
table: "AbpAITokenUsages", |
||||
|
columns: new[] { "TenantId", "ConversationId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAIWorkspaceDefinitions_Name", |
||||
|
table: "AbpAIWorkspaceDefinitions", |
||||
|
column: "Name", |
||||
|
unique: true); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAIConversations"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAITextChatMessages"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAITokenUsages"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAIWorkspaceDefinitions"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,49 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class AddNotificationSendRecord : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AppNotificationSendRecords", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<long>(type: "bigint", nullable: false) |
||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |
||||
|
TenantId = table.Column<Guid>(type: "uuid", nullable: true), |
||||
|
Provider = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
||||
|
SendTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false), |
||||
|
UserName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false, defaultValue: "/"), |
||||
|
NotificationId = table.Column<long>(type: "bigint", nullable: false), |
||||
|
NotificationName = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false), |
||||
|
State = table.Column<int>(type: "integer", nullable: false), |
||||
|
Reason = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AppNotificationSendRecords", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_Tenant_Send_Notification_Name", |
||||
|
table: "AppNotificationSendRecords", |
||||
|
columns: new[] { "TenantId", "NotificationName" }); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AppNotificationSendRecords"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,150 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class AddAIManagementModule : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAIConversations", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), |
||||
|
Workspace = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
ExpiredAt = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
UpdateAt = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAIConversations", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAITextChatMessages", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Content = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Workspace = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Role = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false), |
||||
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ConversationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ReplyMessage = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ReplyAt = table.Column<DateTime>(type: "datetime2", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAITextChatMessages", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAITokenUsages", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
MessageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ConversationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
InputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
OutputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
TotalTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
CachedInputTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
ReasoningTokenCount = table.Column<long>(type: "bigint", nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAITokenUsages", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AbpAIWorkspaceDefinitions", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
Provider = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false), |
||||
|
ModelName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), |
||||
|
DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
||||
|
Description = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true), |
||||
|
ApiKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true), |
||||
|
ApiBaseUrl = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true), |
||||
|
SystemPrompt = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true), |
||||
|
Instructions = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true), |
||||
|
Temperature = table.Column<float>(type: "real", nullable: true), |
||||
|
MaxOutputTokens = table.Column<int>(type: "int", nullable: true), |
||||
|
FrequencyPenalty = table.Column<float>(type: "real", nullable: true), |
||||
|
PresencePenalty = table.Column<float>(type: "real", nullable: true), |
||||
|
IsEnabled = table.Column<bool>(type: "bit", nullable: false), |
||||
|
IsSystem = table.Column<bool>(type: "bit", nullable: false), |
||||
|
StateCheckers = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AbpAIWorkspaceDefinitions", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAITextChatMessages_TenantId_ConversationId", |
||||
|
table: "AbpAITextChatMessages", |
||||
|
columns: new[] { "TenantId", "ConversationId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAITokenUsages_TenantId_ConversationId", |
||||
|
table: "AbpAITokenUsages", |
||||
|
columns: new[] { "TenantId", "ConversationId" }); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_AbpAIWorkspaceDefinitions_Name", |
||||
|
table: "AbpAIWorkspaceDefinitions", |
||||
|
column: "Name", |
||||
|
unique: true); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAIConversations"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAITextChatMessages"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAITokenUsages"); |
||||
|
|
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AbpAIWorkspaceDefinitions"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,48 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer.Migrations |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
public partial class AddNotificationSendRecord : Migration |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "AppNotificationSendRecords", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<long>(type: "bigint", nullable: false) |
||||
|
.Annotation("SqlServer:Identity", "1, 1"), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
Provider = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), |
||||
|
SendTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
UserName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false, defaultValue: "/"), |
||||
|
NotificationId = table.Column<long>(type: "bigint", nullable: false), |
||||
|
NotificationName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false), |
||||
|
State = table.Column<int>(type: "int", nullable: false), |
||||
|
Reason = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_AppNotificationSendRecords", x => x.Id); |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_Tenant_Send_Notification_Name", |
||||
|
table: "AppNotificationSendRecords", |
||||
|
columns: new[] { "TenantId", "NotificationName" }); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "AppNotificationSendRecords"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public class NotificationSendRecordDto : EntityDto<string> |
||||
|
{ |
||||
|
public string Provider { get; set; } |
||||
|
public DateTime SendTime { get; set; } |
||||
|
public Guid UserId { get; set; } |
||||
|
public string UserName { get; set; } |
||||
|
public NotificationSendState State { get; set; } |
||||
|
public string Reason { get; set; } |
||||
|
public UserNotificationDto Notification { get; set; } |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
|
||||
|
#nullable enable |
||||
|
public class NotificationSendRecordGetPagedListInput : PagedAndSortedResultRequestDto |
||||
|
{ |
||||
|
public string? Provider { get; set; } |
||||
|
public DateTime? BeginSendTime { get; set; } |
||||
|
public DateTime? EndSendTime { get; set; } |
||||
|
public Guid? UserId { get; set; } |
||||
|
public string? NotificationName { get; set; } |
||||
|
public NotificationSendState? State { get; set; } |
||||
|
} |
||||
|
#nullable disable |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public interface INotificationSendRecordAppService : IApplicationService |
||||
|
{ |
||||
|
Task DeleteAsync(long id); |
||||
|
|
||||
|
Task ReSendAsync(long id); |
||||
|
|
||||
|
Task<PagedResultDto<NotificationSendRecordDto>> GetListAsync(NotificationSendRecordGetPagedListInput input); |
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
using LINGYUN.Abp.Notifications.Permissions; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Specifications; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
|
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.Default)] |
||||
|
public class NotificationSendRecordAppService : AbpNotificationsApplicationServiceBase, INotificationSendRecordAppService |
||||
|
{ |
||||
|
private readonly INotificationSendRecordRepository _repository; |
||||
|
|
||||
|
protected INotificationStore NotificationStore => LazyServiceProvider.LazyGetRequiredService<INotificationStore>(); |
||||
|
|
||||
|
protected INotificationSender NotificationSender => LazyServiceProvider.LazyGetRequiredService<INotificationSender>(); |
||||
|
|
||||
|
protected INotificationDefinitionManager NotificationDefinitionManager => LazyServiceProvider.LazyGetRequiredService<INotificationDefinitionManager>(); |
||||
|
|
||||
|
public NotificationSendRecordAppService(INotificationSendRecordRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.Delete)] |
||||
|
public async virtual Task DeleteAsync(long id) |
||||
|
{ |
||||
|
var sendRecord = await _repository.GetAsync(id); |
||||
|
|
||||
|
await _repository.DeleteAsync(sendRecord); |
||||
|
} |
||||
|
|
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.ReSend)] |
||||
|
public async virtual Task ReSendAsync(long id) |
||||
|
{ |
||||
|
var sendRecord = await _repository.GetAsync(id); |
||||
|
var notificationInfo = await NotificationStore.GetNotificationOrNullAsync(sendRecord.TenantId, sendRecord.NotificationId); |
||||
|
var notificationDefine = await NotificationDefinitionManager.GetOrNullAsync(notificationInfo.Name); |
||||
|
|
||||
|
if (notificationDefine?.Template != null) |
||||
|
{ |
||||
|
var template = new NotificationTemplate( |
||||
|
notificationInfo.Name, |
||||
|
data: notificationInfo.Data.ExtraProperties); |
||||
|
|
||||
|
await NotificationSender.SendNofiterAsync( |
||||
|
notificationInfo.Name, |
||||
|
template, |
||||
|
[new UserIdentifier(sendRecord.UserId, sendRecord.UserName)], |
||||
|
sendRecord.TenantId, |
||||
|
notificationInfo.Severity, |
||||
|
[sendRecord.Provider]); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
await NotificationSender.SendNofiterAsync( |
||||
|
notificationInfo.Name, |
||||
|
notificationInfo.Data, |
||||
|
[new UserIdentifier(sendRecord.UserId, sendRecord.UserName)], |
||||
|
sendRecord.TenantId, |
||||
|
notificationInfo.Severity, |
||||
|
[sendRecord.Provider]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<PagedResultDto<NotificationSendRecordDto>> GetListAsync(NotificationSendRecordGetPagedListInput input) |
||||
|
{ |
||||
|
Expression<Func<NotificationSendRecordInfo, bool>> expression = _ => true; |
||||
|
|
||||
|
if (input.State.HasValue) |
||||
|
{ |
||||
|
expression = expression.And(x => x.State == input.State); |
||||
|
} |
||||
|
if (!input.Provider.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
expression = expression.And(x => x.Provider == input.Provider); |
||||
|
} |
||||
|
if (!input.NotificationName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
expression = expression.And(x => x.NotificationInfo.Name == input.NotificationName); |
||||
|
} |
||||
|
if (input.UserId.HasValue) |
||||
|
{ |
||||
|
expression = expression.And(x => x.UserId == input.UserId); |
||||
|
} |
||||
|
if (input.BeginSendTime.HasValue) |
||||
|
{ |
||||
|
expression = expression.And(x => x.SendTime >= input.BeginSendTime); |
||||
|
} |
||||
|
if (input.EndSendTime.HasValue) |
||||
|
{ |
||||
|
expression = expression.And(x => x.SendTime <= input.EndSendTime); |
||||
|
} |
||||
|
|
||||
|
var specification = new ExpressionSpecification<NotificationSendRecordInfo>(expression); |
||||
|
|
||||
|
var totalCount = await _repository.GetCountAsync(specification); |
||||
|
var list = await _repository.GetListAsync(specification, |
||||
|
input.Sorting, input.MaxResultCount, input.SkipCount); |
||||
|
|
||||
|
return new PagedResultDto<NotificationSendRecordDto>(totalCount, |
||||
|
ObjectMapper.Map<List<NotificationSendRecordInfo>, List<NotificationSendRecordDto>>(list)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using JetBrains.Annotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
|
||||
|
#nullable enable |
||||
|
public class NotificationPublishContext |
||||
|
{ |
||||
|
[NotNull] |
||||
|
public NotificationInfo Notification { get; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public IEnumerable<UserIdentifier> Users { get; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public string? Reason { get; private set; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public Exception? Exception { get; private set; } |
||||
|
public NotificationPublishContext( |
||||
|
NotificationInfo notification, |
||||
|
IEnumerable<UserIdentifier> users) |
||||
|
{ |
||||
|
Notification = notification; |
||||
|
Users = users; |
||||
|
} |
||||
|
|
||||
|
public void Cancel(string reason, Exception exception = null) |
||||
|
{ |
||||
|
Reason = reason; |
||||
|
Exception = exception; |
||||
|
} |
||||
|
} |
||||
|
#nullable disable |
||||
@ -0,0 +1,49 @@ |
|||||
|
using JetBrains.Annotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public class NotificationSendInfo |
||||
|
{ |
||||
|
public string Provider { get; } |
||||
|
public DateTime SendTime { get; } |
||||
|
public NotificationInfo NotificationInfo { get; } |
||||
|
public IEnumerable<UserIdentifier> Users { get; } |
||||
|
public NotificationSendState State { get; private set; } |
||||
|
public string Reason { get; private set; } |
||||
|
public NotificationSendInfo( |
||||
|
[NotNull] string provider, |
||||
|
DateTime sendTime, |
||||
|
NotificationInfo notificationInfo, |
||||
|
IEnumerable<UserIdentifier> users) |
||||
|
{ |
||||
|
Check.NotNullOrWhiteSpace(provider, nameof(provider)); |
||||
|
Check.NotNull(notificationInfo, nameof(notificationInfo)); |
||||
|
Check.NotNull(users, nameof(users)); |
||||
|
|
||||
|
Provider = provider; |
||||
|
SendTime = sendTime; |
||||
|
NotificationInfo = notificationInfo; |
||||
|
Users = users; |
||||
|
|
||||
|
State = NotificationSendState.None; |
||||
|
} |
||||
|
|
||||
|
public void Cancel(string reason) |
||||
|
{ |
||||
|
State = NotificationSendState.None; |
||||
|
Reason = reason; |
||||
|
} |
||||
|
|
||||
|
public void Disbaled() |
||||
|
{ |
||||
|
State = NotificationSendState.Disabled; |
||||
|
} |
||||
|
|
||||
|
public void Sent(Exception exception = null) |
||||
|
{ |
||||
|
State = exception != null ? NotificationSendState.Failed : NotificationSendState.Sent; |
||||
|
Reason = exception?.Message; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
/// <summary>
|
||||
|
/// 发送状态
|
||||
|
/// </summary>
|
||||
|
public enum NotificationSendState |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 未发送
|
||||
|
/// </summary>
|
||||
|
None, |
||||
|
/// <summary>
|
||||
|
/// 提供者禁用
|
||||
|
/// </summary>
|
||||
|
Disabled, |
||||
|
/// <summary>
|
||||
|
/// 已发送
|
||||
|
/// </summary>
|
||||
|
Sent, |
||||
|
/// <summary>
|
||||
|
/// 发送失败
|
||||
|
/// </summary>
|
||||
|
Failed |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public static class NotificationSendRecordConsts |
||||
|
{ |
||||
|
public static int MaxProviderLength { get; set; } = 50; |
||||
|
public static int MaxReasonLength { get; set; } = 255; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Specifications; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public interface INotificationSendRecordRepository : IBasicRepository<NotificationSendRecord, long> |
||||
|
{ |
||||
|
Task<int> GetCountAsync( |
||||
|
ISpecification<NotificationSendRecordInfo> specification, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<NotificationSendRecordInfo>> GetListAsync( |
||||
|
ISpecification<NotificationSendRecordInfo> specification, |
||||
|
string sorting = $"{nameof(NotificationSendRecordInfo.SendTime)} DESC", |
||||
|
int maxResultCount = 10, |
||||
|
int skipCount = 0, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public class NotificationSendRecord : Entity<long>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual string Provider { get; protected set; } |
||||
|
public virtual DateTime SendTime { get; protected set; } |
||||
|
public virtual Guid UserId { get; protected set; } |
||||
|
public virtual string UserName { get; protected set; } |
||||
|
public virtual long NotificationId { get; protected set; } |
||||
|
public virtual string NotificationName { get; protected set; } |
||||
|
public virtual NotificationSendState State { get; protected set; } |
||||
|
public virtual string Reason { get; protected set; } |
||||
|
protected NotificationSendRecord() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public NotificationSendRecord( |
||||
|
string provider, |
||||
|
DateTime sendTime, |
||||
|
Guid userId, |
||||
|
string userName, |
||||
|
long notificationId, |
||||
|
string notificationName, |
||||
|
NotificationSendState state, |
||||
|
string reason = null, |
||||
|
Guid? tenantId = null) |
||||
|
{ |
||||
|
Provider = Check.NotNullOrWhiteSpace(provider, nameof(provider), NotificationSendRecordConsts.MaxProviderLength); |
||||
|
SendTime = sendTime; |
||||
|
UserId = userId; |
||||
|
UserName = Check.Length(userName, nameof(userName), SubscribeConsts.MaxUserNameLength); |
||||
|
NotificationId = notificationId; |
||||
|
NotificationName = Check.NotNullOrWhiteSpace(notificationName, nameof(notificationName), NotificationConsts.MaxNameLength); |
||||
|
State = state; |
||||
|
Reason = reason; |
||||
|
TenantId = tenantId; |
||||
|
|
||||
|
if (!Reason.IsNullOrWhiteSpace() && Reason.Length > NotificationSendRecordConsts.MaxReasonLength) |
||||
|
{ |
||||
|
Reason = Reason.Substring(0, NotificationSendRecordConsts.MaxReasonLength); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
public class NotificationSendRecordInfo |
||||
|
{ |
||||
|
public long Id { get; set; } |
||||
|
public string Provider { get; set; } |
||||
|
public DateTime SendTime { get; set; } |
||||
|
public Guid UserId { get; set; } |
||||
|
public string UserName { get; set; } |
||||
|
public NotificationSendState State { get; set; } |
||||
|
public string Reason { get; set; } |
||||
|
public UserNotificationInfo NotificationInfo { get; set; } |
||||
|
} |
||||
@ -0,0 +1,99 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Dynamic.Core; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.Specifications; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications.EntityFrameworkCore; |
||||
|
public class EfCoreNotificationSendRecordRepository : |
||||
|
EfCoreRepository<INotificationsDbContext, NotificationSendRecord, long>, |
||||
|
INotificationSendRecordRepository |
||||
|
{ |
||||
|
public EfCoreNotificationSendRecordRepository( |
||||
|
IDbContextProvider<INotificationsDbContext> dbContextProvider) |
||||
|
: base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<int> GetCountAsync( |
||||
|
ISpecification<NotificationSendRecordInfo> specification, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetSendRecordInfoAsync()) |
||||
|
.Where(specification.ToExpression()) |
||||
|
.CountAsync(GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<List<NotificationSendRecordInfo>> GetListAsync( |
||||
|
ISpecification<NotificationSendRecordInfo> specification, |
||||
|
string sorting = $"{nameof(NotificationSendRecordInfo.SendTime)} DESC", |
||||
|
int maxResultCount = 10, |
||||
|
int skipCount = 0, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetSendRecordInfoAsync()) |
||||
|
.Where(specification.ToExpression()) |
||||
|
.OrderBy(!sorting.IsNullOrWhiteSpace() ? sorting : $"{nameof(NotificationSendRecordInfo.SendTime)} DESC") |
||||
|
.PageBy(skipCount, maxResultCount) |
||||
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
|
||||
|
protected async virtual Task<IQueryable<NotificationSendRecordInfo>> GetSendRecordInfoAsync() |
||||
|
{ |
||||
|
var dbContext = await GetDbContextAsync(); |
||||
|
|
||||
|
return dbContext.Set<Notification>() |
||||
|
.Join( |
||||
|
dbContext.Set<UserNotification>(), |
||||
|
n => n.NotificationId, |
||||
|
un => un.NotificationId, |
||||
|
(n, un) => new |
||||
|
{ |
||||
|
NotificationId = n.NotificationId, |
||||
|
NotificationName = n.NotificationName, |
||||
|
NotificationTypeName = n.NotificationTypeName, |
||||
|
TenantId = n.TenantId, |
||||
|
Type = n.Type, |
||||
|
Severity = n.Severity, |
||||
|
ContentType = n.ContentType, |
||||
|
CreationTime = n.CreationTime, |
||||
|
ExtraProperties = n.ExtraProperties, |
||||
|
State = un.ReadStatus, |
||||
|
UserId = un.UserId, |
||||
|
Id = un.Id, |
||||
|
}) |
||||
|
.Join( |
||||
|
dbContext.Set<NotificationSendRecord>(), |
||||
|
un => new { un.UserId, un.NotificationId }, |
||||
|
nsr => new { nsr.UserId, nsr.NotificationId }, |
||||
|
(un, nsr) => new NotificationSendRecordInfo |
||||
|
{ |
||||
|
Id = nsr.Id, |
||||
|
UserId = nsr.UserId, |
||||
|
UserName = nsr.UserName, |
||||
|
Provider = nsr.Provider, |
||||
|
State = nsr.State, |
||||
|
Reason = nsr.Reason, |
||||
|
SendTime = nsr.SendTime, |
||||
|
NotificationInfo = new UserNotificationInfo |
||||
|
{ |
||||
|
TenantId = un.TenantId, |
||||
|
Type = un.Type, |
||||
|
Severity = un.Severity, |
||||
|
ContentType = un.ContentType, |
||||
|
CreationTime = un.CreationTime, |
||||
|
ExtraProperties = un.ExtraProperties, |
||||
|
NotificationId = un.NotificationId, |
||||
|
NotificationTypeName = un.NotificationTypeName, |
||||
|
Name = un.NotificationName, |
||||
|
State = un.State, |
||||
|
Id = un.Id, |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
using LINGYUN.Abp.Notifications.Permissions; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Notifications; |
||||
|
|
||||
|
[Controller] |
||||
|
[RemoteService(Name = AbpNotificationsRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(AbpNotificationsRemoteServiceConsts.ModuleName)] |
||||
|
[Route("api/notifications/send-records")] |
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.Default)] |
||||
|
public class NotificationSendRecordController : AbpControllerBase, INotificationSendRecordAppService |
||||
|
{ |
||||
|
private readonly INotificationSendRecordAppService _service; |
||||
|
public NotificationSendRecordController(INotificationSendRecordAppService service) |
||||
|
{ |
||||
|
_service = service; |
||||
|
} |
||||
|
|
||||
|
[HttpDelete] |
||||
|
[Route("{id}")] |
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.Delete)] |
||||
|
public virtual Task DeleteAsync(long id) |
||||
|
{ |
||||
|
return _service.DeleteAsync(id); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
public virtual Task<PagedResultDto<NotificationSendRecordDto>> GetListAsync(NotificationSendRecordGetPagedListInput input) |
||||
|
{ |
||||
|
return _service.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[Route("{id}/re-send")] |
||||
|
[Authorize(NotificationsPermissions.Notification.SendRecord.ReSend)] |
||||
|
public virtual Task ReSendAsync(long id) |
||||
|
{ |
||||
|
return _service.ReSendAsync(id); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
{ |
||||
|
"Quartz": { |
||||
|
"UsePersistentStore": true, |
||||
|
"Properties": { |
||||
|
"quartz.jobStore.dataSource": "tkm", |
||||
|
"quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", |
||||
|
"quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.PostgreSQLDelegate,Quartz", |
||||
|
"quartz.dataSource.tkm.connectionString": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"quartz.dataSource.tkm.connectionStringName": "TaskManagement", |
||||
|
"quartz.dataSource.tkm.provider": "Npgsql", |
||||
|
"quartz.jobStore.clustered": "true", |
||||
|
"quartz.serializer.type": "json" |
||||
|
} |
||||
|
}, |
||||
|
"ConnectionStrings": { |
||||
|
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpSaas": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpTenantManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpSettingManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpPermissionManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpFeatureManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpTextTemplating": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer", |
||||
|
"AbpLocalizationManagement": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;SslMode=Prefer" |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue