feat: 新增配额包/支付相关实体与迁移

App:新增 operation_logs/quota_packages/tenant_payments/tenant_quota_package_purchases 表

Identity:修正 Avatar 字段类型(varchar(256)->text),保持现有数据不变
This commit is contained in:
2025-12-17 17:27:45 +08:00
parent 9c28790f5e
commit ab59e2e3e2
103 changed files with 14450 additions and 4 deletions

View File

@@ -5680,6 +5680,167 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.OperationLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("OperationType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("操作类型BatchExtend, BatchRemind, StatusChange 等。");
b.Property<string>("OperatorId")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("操作人ID。");
b.Property<string>("OperatorName")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("操作人名称。");
b.Property<string>("Parameters")
.HasColumnType("text")
.HasComment("操作参数JSON。");
b.Property<string>("Result")
.HasColumnType("text")
.HasComment("操作结果JSON。");
b.Property<bool>("Success")
.HasColumnType("boolean")
.HasComment("是否成功。");
b.Property<string>("TargetIds")
.HasColumnType("text")
.HasComment("目标ID列表JSON。");
b.Property<string>("TargetType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("目标类型Subscription, Bill 等。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("CreatedAt");
b.HasIndex("OperationType", "CreatedAt");
b.ToTable("operation_logs", null, t =>
{
t.HasComment("运营操作日志。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.QuotaPackage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<string>("Description")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("描述。");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否上架。");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasComment("配额包名称。");
b.Property<decimal>("Price")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("价格。");
b.Property<int>("QuotaType")
.HasColumnType("integer")
.HasComment("配额类型。");
b.Property<decimal>("QuotaValue")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("配额数值。");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0)
.HasComment("排序。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("QuotaType", "IsActive", "SortOrder");
b.ToTable("quota_packages", null, t =>
{
t.HasComment("配额包定义(平台提供的可购买配额包)。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.Tenant", b =>
{
b.Property<long>("Id")
@@ -6342,6 +6503,163 @@ namespace TakeoutSaaS.Infrastructure.Migrations
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantPayment", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<decimal>("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("支付金额。");
b.Property<long>("BillingStatementId")
.HasColumnType("bigint")
.HasComment("关联的账单 ID。");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<int>("Method")
.HasColumnType("integer")
.HasComment("支付方式。");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("备注信息。");
b.Property<DateTime?>("PaidAt")
.HasColumnType("timestamp with time zone")
.HasComment("支付时间。");
b.Property<string>("ProofUrl")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("支付凭证 URL。");
b.Property<int>("Status")
.HasColumnType("integer")
.HasComment("支付状态。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<string>("TransactionNo")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasComment("交易号。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId", "BillingStatementId");
b.ToTable("tenant_payments", null, t =>
{
t.HasComment("租户支付记录。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantQuotaPackagePurchase", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasComment("实体唯一标识。");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间UTC。");
b.Property<long?>("CreatedBy")
.HasColumnType("bigint")
.HasComment("创建人用户标识,匿名或系统操作时为 null。");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasComment("软删除时间UTC未删除时为 null。");
b.Property<long?>("DeletedBy")
.HasColumnType("bigint")
.HasComment("删除人用户标识(软删除),未删除时为 null。");
b.Property<DateTime?>("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasComment("过期时间(可选)。");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasComment("备注。");
b.Property<decimal>("Price")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("购买价格。");
b.Property<DateTime>("PurchasedAt")
.HasColumnType("timestamp with time zone")
.HasComment("购买时间。");
b.Property<long>("QuotaPackageId")
.HasColumnType("bigint")
.HasComment("配额包 ID。");
b.Property<decimal>("QuotaValue")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
.HasComment("购买时的配额值。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");
b.Property<long?>("UpdatedBy")
.HasColumnType("bigint")
.HasComment("最后更新人用户标识,匿名或系统操作时为 null。");
b.HasKey("Id");
b.HasIndex("TenantId", "QuotaPackageId", "PurchasedAt");
b.ToTable("tenant_quota_package_purchases", null, t =>
{
t.HasComment("租户配额包购买记录。");
});
});
modelBuilder.Entity("TakeoutSaaS.Domain.Tenants.Entities.TenantQuotaUsage", b =>
{
b.Property<long>("Id")