Fix db and fix endpoints

This commit is contained in:
2025-08-05 22:30:18 +07:00
parent 2dcbcc3ef2
commit 36529ae403
36 changed files with 5073 additions and 245 deletions

View File

@@ -35,6 +35,7 @@ namespace Managing.Infrastructure.Databases.Migrations
.HasColumnType("text");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
@@ -51,7 +52,7 @@ namespace Managing.Infrastructure.Databases.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int?>("UserId")
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
@@ -192,10 +193,8 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("UserId")
.HasColumnType("integer");
b.Property<int>("WinRate")
.HasColumnType("integer");
@@ -209,11 +208,11 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasIndex("Score");
b.HasIndex("UserName");
b.HasIndex("UserId");
b.HasIndex("RequestId", "Score");
b.HasIndex("UserName", "Score");
b.HasIndex("UserId", "Score");
b.ToTable("Backtests");
});
@@ -347,11 +346,6 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<int?>("UserId")
.HasColumnType("integer");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.HasKey("Id");
b.HasIndex("RequestId")
@@ -361,9 +355,7 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasIndex("UserId");
b.HasIndex("UserName");
b.HasIndex("UserName", "CreatedAt");
b.HasIndex("UserId", "CreatedAt");
b.ToTable("BundleBacktestRequests");
});
@@ -593,15 +585,14 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int?>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserName");
b.HasIndex("UserId");
b.HasIndex("UserName", "Name");
b.HasIndex("UserId", "Name");
b.ToTable("Indicators");
});
@@ -715,9 +706,8 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int?>("UserId")
.HasColumnType("integer");
b.HasKey("Identifier");
@@ -736,9 +726,9 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasIndex("TakeProfit2TradeId");
b.HasIndex("UserName");
b.HasIndex("UserId");
b.HasIndex("UserName", "Identifier");
b.HasIndex("UserId", "Identifier");
b.ToTable("Positions");
});
@@ -765,15 +755,14 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("UserName");
b.HasIndex("UserId");
b.HasIndex("UserName", "Name");
b.HasIndex("UserId", "Name");
b.ToTable("Scenarios");
});
@@ -863,9 +852,8 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserName")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<int?>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
@@ -877,11 +865,11 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasIndex("Ticker");
b.HasIndex("UserName");
b.HasIndex("UserId");
b.HasIndex("UserName", "Date");
b.HasIndex("UserId", "Date");
b.HasIndex("Identifier", "Date", "UserName")
b.HasIndex("Identifier", "Date", "UserId")
.IsUnique();
b.ToTable("Signals");
@@ -1213,6 +1201,9 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Users");
});
@@ -1256,7 +1247,8 @@ namespace Managing.Infrastructure.Databases.Migrations
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull);
.OnDelete(DeleteBehavior.SetNull)
.IsRequired();
b.Navigation("User");
});
@@ -1272,6 +1264,17 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BacktestEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.BotEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
@@ -1303,6 +1306,16 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.IndicatorEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.MoneyManagementEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
@@ -1335,6 +1348,11 @@ namespace Managing.Infrastructure.Databases.Migrations
.HasForeignKey("TakeProfit2TradeId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("OpenTrade");
b.Navigation("StopLossTrade");
@@ -1342,6 +1360,19 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Navigation("TakeProfit1Trade");
b.Navigation("TakeProfit2Trade");
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.ScenarioEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.ScenarioIndicatorEntity", b =>
@@ -1363,6 +1394,16 @@ namespace Managing.Infrastructure.Databases.Migrations
b.Navigation("Scenario");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.SignalEntity", b =>
{
b.HasOne("Managing.Infrastructure.Databases.PostgreSql.Entities.UserEntity", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("User");
});
modelBuilder.Entity("Managing.Infrastructure.Databases.PostgreSql.Entities.IndicatorEntity", b =>
{
b.Navigation("ScenarioIndicators");