Fix db and fix endpoints
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
|
||||
|
||||
[Table("Accounts")]
|
||||
public class AccountEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public TradingExchanges Exchange { get; set; }
|
||||
public AccountType Type { get; set; }
|
||||
public string? Key { get; set; }
|
||||
[Key] public int Id { get; set; }
|
||||
[Required] public string Name { get; set; }
|
||||
[Required] public TradingExchanges Exchange { get; set; }
|
||||
[Required] public AccountType Type { get; set; }
|
||||
[Required] public string? Key { get; set; }
|
||||
public string? Secret { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
[Required] public int UserId { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
|
||||
// Store balances as JSON if needed, or skip them entirely
|
||||
// public string? BalancesJson { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,10 @@ public class BacktestEntity
|
||||
public string MoneyManagementJson { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public int UserId { get; set; }
|
||||
|
||||
// Navigation property
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string? StatisticsJson { get; set; }
|
||||
|
||||
@@ -15,7 +15,7 @@ public class BotEntity
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required] [ForeignKey("UserId")] public required UserEntity User { get; set; }
|
||||
[ForeignKey("UserId")] public UserEntity User { get; set; }
|
||||
|
||||
public BotStatus Status { get; set; }
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
@@ -15,10 +15,6 @@ public class BundleBacktestRequestEntity
|
||||
[MaxLength(255)]
|
||||
public string RequestId { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
// Foreign key to User entity
|
||||
public int? UserId { get; set; }
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
|
||||
|
||||
[Table("GeneticRequests")]
|
||||
public class GeneticRequestEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
@@ -28,12 +28,14 @@ public class IndicatorEntity
|
||||
public int? SmoothPeriods { get; set; }
|
||||
public int? CyclePeriods { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? UserName { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation properties
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
// Navigation property for the many-to-many relationship with scenarios
|
||||
public virtual ICollection<ScenarioIndicatorEntity> ScenarioIndicators { get; set; } = new List<ScenarioIndicatorEntity>();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class PositionEntity
|
||||
|
||||
[MaxLength(255)] public string AccountName { get; set; }
|
||||
|
||||
[MaxLength(255)] public string? UserName { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
// Foreign keys to trades
|
||||
public int? OpenTradeId { get; set; }
|
||||
@@ -37,6 +37,8 @@ public class PositionEntity
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation properties
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
[ForeignKey("OpenTradeId")] public virtual TradeEntity? OpenTrade { get; set; }
|
||||
|
||||
[ForeignKey("StopLossTradeId")] public virtual TradeEntity? StopLossTrade { get; set; }
|
||||
|
||||
@@ -15,12 +15,15 @@ public class ScenarioEntity
|
||||
|
||||
public int LoopbackPeriod { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? UserName { get; set; }
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation properties
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
// Navigation property for the many-to-many relationship with indicators
|
||||
public virtual ICollection<ScenarioIndicatorEntity> ScenarioIndicators { get; set; } = new List<ScenarioIndicatorEntity>();
|
||||
}
|
||||
@@ -26,8 +26,10 @@ public class SignalEntity
|
||||
[MaxLength(255)]
|
||||
public string IndicatorName { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? UserName { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
// Navigation property
|
||||
public UserEntity? User { get; set; }
|
||||
|
||||
// Candle data stored as JSON
|
||||
[Column(TypeName = "text")]
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
|
||||
|
||||
[Table("Users")]
|
||||
[Index(nameof(Name), IsUnique = true)]
|
||||
public class UserEntity
|
||||
{
|
||||
[Key] public int Id { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user