//
using System;
using Apimanager_backend.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Apimanager_backend.Migrations
{
[DbContext(typeof(ApiContext))]
[Migration("20250731104930_add_user_Avatar")]
partial class add_user_Avatar
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property("Endpoint")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("IsActive")
.HasColumnType("tinyint(1)");
b.Property("IsDelete")
.HasColumnType("tinyint(1)");
b.Property("IsThirdParty")
.HasColumnType("tinyint(1)");
b.Property("Method")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property("PackageId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Endpoint")
.IsUnique();
b.HasIndex("PackageId");
b.ToTable("Apis");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiCallLog", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ApiId")
.HasColumnType("int");
b.Property("CallResult")
.HasColumnType("int");
b.Property("CallTime")
.HasColumnType("datetime(6)");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ApiId");
b.HasIndex("UserId");
b.ToTable("CallLogs");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiPackageItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ApiId")
.HasColumnType("int");
b.Property("ApiPackageId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ApiId");
b.HasIndex("ApiPackageId");
b.ToTable("ApiPackageItem");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiRequestExample", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ApiId")
.HasColumnType("int");
b.Property("Request")
.IsRequired()
.HasColumnType("longtext");
b.Property("Response")
.IsRequired()
.HasColumnType("longtext");
b.Property("ResponseType")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("ApiId");
b.ToTable("ApiRequestExample");
});
modelBuilder.Entity("Apimanager_backend.Models.Apipackage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("CallLimit")
.HasColumnType("int");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("varchar(20)");
b.Property("OneMinuteLimit")
.HasColumnType("int");
b.Property("Price")
.HasColumnType("decimal(65,30)");
b.HasKey("Id");
b.ToTable("Apipackages");
});
modelBuilder.Entity("Apimanager_backend.Models.Log", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("Exception")
.IsRequired()
.HasColumnType("longtext");
b.Property("LogLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property("Message")
.IsRequired()
.HasColumnType("longtext");
b.Property("MessageTemplate")
.IsRequired()
.HasColumnType("longtext");
b.Property("Properties")
.IsRequired()
.HasColumnType("longtext");
b.Property("Timestamp")
.HasColumnType("datetime(6)");
b.HasKey("Id");
b.ToTable("Logs");
});
modelBuilder.Entity("Apimanager_backend.Models.OperationLog", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property("IpAddress")
.IsRequired()
.HasMaxLength(45)
.HasColumnType("varchar(45)");
b.Property("Operation")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("varchar(20)");
b.Property("TargetId")
.HasColumnType("int");
b.Property("TargetType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property("UserAgent")
.IsRequired()
.HasColumnType("longtext");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("OperationLogs");
});
modelBuilder.Entity("Apimanager_backend.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("Amount")
.HasColumnType("decimal(65,30)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Description")
.HasColumnType("longtext");
b.Property("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property("OrderNumber")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("OrderType")
.HasColumnType("int");
b.Property("PaiAt")
.HasColumnType("datetime(6)");
b.Property("PaymentType")
.HasColumnType("int");
b.Property("Status")
.HasColumnType("int");
b.Property("ThirdPartyOrderId")
.HasColumnType("varchar(255)");
b.Property("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderNumber")
.IsUnique();
b.HasIndex("ThirdPartyOrderId")
.IsUnique();
b.HasIndex("UserId");
b.ToTable("Orders");
});
modelBuilder.Entity("Apimanager_backend.Models.PaymentConfig", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("AppId")
.HasColumnType("longtext");
b.Property("Description")
.HasColumnType("longtext");
b.Property("ExtraSettingsJson")
.HasColumnType("longtext");
b.Property("GatewayUrl")
.HasColumnType("longtext");
b.Property("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property("Method")
.HasColumnType("int");
b.Property("NotifyUrl")
.HasColumnType("longtext");
b.Property("PayType")
.HasColumnType("int");
b.Property("PublicKey")
.HasColumnType("longtext");
b.Property("SecretKey")
.HasColumnType("longtext");
b.Property("Url")
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("paymentConfigs");
b.HasData(
new
{
Id = 1,
AppId = "",
GatewayUrl = "",
IsEnabled = false,
Method = 0,
NotifyUrl = "",
PayType = 1,
PublicKey = "",
SecretKey = ""
},
new
{
Id = 2,
AppId = "",
GatewayUrl = "",
IsEnabled = false,
Method = 1,
NotifyUrl = "",
PayType = 1,
PublicKey = "",
SecretKey = ""
},
new
{
Id = 3,
AppId = "",
GatewayUrl = "",
IsEnabled = false,
Method = 3,
NotifyUrl = "",
PayType = 1,
PublicKey = "",
SecretKey = ""
},
new
{
Id = 4,
AppId = "",
GatewayUrl = "",
IsEnabled = false,
Method = 2,
NotifyUrl = "",
PayType = 1,
PublicKey = "",
SecretKey = ""
});
});
modelBuilder.Entity("Apimanager_backend.Models.SystemConfig", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ConfigBody")
.IsRequired()
.HasColumnType("longtext");
b.Property("ConfigName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("SystemConfigs");
b.HasData(
new
{
Id = 1,
ConfigBody = "青蓝",
ConfigName = "SystemName"
},
new
{
Id = 2,
ConfigBody = "描述",
ConfigName = "SystemDescription"
},
new
{
Id = 3,
ConfigBody = "",
ConfigName = "LogoLocation"
},
new
{
Id = 4,
ConfigBody = "",
ConfigName = "FaviconLocation"
},
new
{
Id = 5,
ConfigBody = "13000000000",
ConfigName = "Phone"
},
new
{
Id = 6,
ConfigBody = "admin@admin.com",
ConfigName = "Email"
},
new
{
Id = 7,
ConfigBody = "{\"RegisterOn\":true,\"Emailvalidate\":true}",
ConfigName = "RegisterConfig"
});
});
modelBuilder.Entity("Apimanager_backend.Models.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ApiKey")
.HasColumnType("longtext");
b.Property("Avatar")
.HasColumnType("longtext");
b.Property("Balance")
.HasColumnType("decimal(65,30)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Email")
.IsRequired()
.HasColumnType("varchar(255)");
b.Property("IsBan")
.HasColumnType("tinyint(1)");
b.Property("IsDelete")
.HasColumnType("tinyint(1)");
b.Property("PassHash")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property("Username")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
b.HasData(
new
{
Id = -1,
Balance = 0m,
CreatedAt = new DateTime(2025, 7, 31, 10, 49, 29, 419, DateTimeKind.Utc).AddTicks(6892),
Email = "admin1@admin.com",
IsBan = false,
IsDelete = false,
PassHash = "e10adc3949ba59abbe56e057f20f883e",
Username = "admin"
});
});
modelBuilder.Entity("Apimanager_backend.Models.UserPackage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("ExpiryDate")
.HasColumnType("datetime(6)");
b.Property("PackageId")
.HasColumnType("int");
b.Property("PurchasedAt")
.HasColumnType("datetime(6)");
b.Property("RemainingCalls")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PackageId");
b.HasIndex("UserId");
b.ToTable("UserPackages");
});
modelBuilder.Entity("Apimanager_backend.Models.UserRole", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property("Role")
.IsRequired()
.HasColumnType("longtext");
b.Property("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserRoles");
});
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
{
b.HasOne("Apimanager_backend.Models.Apipackage", "Package")
.WithMany("Apis")
.HasForeignKey("PackageId");
b.Navigation("Package");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiCallLog", b =>
{
b.HasOne("Apimanager_backend.Models.Api", "Api")
.WithMany("ApiCalls")
.HasForeignKey("ApiId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Apimanager_backend.Models.User", "User")
.WithMany("CallLogs")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Api");
b.Navigation("User");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiPackageItem", b =>
{
b.HasOne("Apimanager_backend.Models.Api", "Api")
.WithMany("ApiPackageItems")
.HasForeignKey("ApiId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Apimanager_backend.Models.Apipackage", "ApiPackage")
.WithMany("ApiPackageItems")
.HasForeignKey("ApiPackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Api");
b.Navigation("ApiPackage");
});
modelBuilder.Entity("Apimanager_backend.Models.ApiRequestExample", b =>
{
b.HasOne("Apimanager_backend.Models.Api", "Api")
.WithMany("ApiRequestExamples")
.HasForeignKey("ApiId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Api");
});
modelBuilder.Entity("Apimanager_backend.Models.OperationLog", b =>
{
b.HasOne("Apimanager_backend.Models.User", "User")
.WithMany("operationLogs")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Apimanager_backend.Models.Order", b =>
{
b.HasOne("Apimanager_backend.Models.User", "User")
.WithMany("Orders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Apimanager_backend.Models.UserPackage", b =>
{
b.HasOne("Apimanager_backend.Models.Apipackage", "Package")
.WithMany("Packages")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Apimanager_backend.Models.User", "User")
.WithMany("Packages")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Package");
b.Navigation("User");
});
modelBuilder.Entity("Apimanager_backend.Models.UserRole", b =>
{
b.HasOne("Apimanager_backend.Models.User", "User")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
{
b.Navigation("ApiCalls");
b.Navigation("ApiPackageItems");
b.Navigation("ApiRequestExamples");
});
modelBuilder.Entity("Apimanager_backend.Models.Apipackage", b =>
{
b.Navigation("ApiPackageItems");
b.Navigation("Apis");
b.Navigation("Packages");
});
modelBuilder.Entity("Apimanager_backend.Models.User", b =>
{
b.Navigation("CallLogs");
b.Navigation("Orders");
b.Navigation("Packages");
b.Navigation("Roles");
b.Navigation("operationLogs");
});
#pragma warning restore 612, 618
}
}
}