Update agent summary data annotation
This commit is contained in:
@@ -1,10 +1,18 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
|
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
|
||||||
|
|
||||||
|
[Table("AgentSummaries")]
|
||||||
|
[Index(nameof(AgentName), IsUnique = true)]
|
||||||
|
[Index(nameof(UserId), IsUnique = true)]
|
||||||
public class AgentSummaryEntity
|
public class AgentSummaryEntity
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
public int UserId { get; set; }
|
[Required] public int Id { get; set; }
|
||||||
public string AgentName { get; set; }
|
[Required] public required int UserId { get; set; }
|
||||||
|
[Required] [MaxLength(255)] public required string AgentName { get; set; }
|
||||||
public decimal TotalPnL { get; set; }
|
public decimal TotalPnL { get; set; }
|
||||||
public decimal TotalROI { get; set; }
|
public decimal TotalROI { get; set; }
|
||||||
public int Wins { get; set; }
|
public int Wins { get; set; }
|
||||||
|
|||||||
@@ -548,11 +548,13 @@ public class ManagingDbContext : DbContext
|
|||||||
entity.Property(e => e.ActiveStrategiesCount).IsRequired();
|
entity.Property(e => e.ActiveStrategiesCount).IsRequired();
|
||||||
entity.Property(e => e.TotalVolume).HasPrecision(18, 8);
|
entity.Property(e => e.TotalVolume).HasPrecision(18, 8);
|
||||||
entity.Property(e => e.TotalBalance).HasPrecision(18, 8);
|
entity.Property(e => e.TotalBalance).HasPrecision(18, 8);
|
||||||
|
entity.Property(e => e.TotalFees).HasPrecision(18, 8);
|
||||||
|
entity.Property(e => e.NetPnL).HasPrecision(18, 8);
|
||||||
entity.Property(e => e.BacktestCount).IsRequired();
|
entity.Property(e => e.BacktestCount).IsRequired();
|
||||||
|
|
||||||
// Create indexes for common queries
|
// Create indexes for common queries
|
||||||
entity.HasIndex(e => e.UserId).IsUnique();
|
entity.HasIndex(e => e.UserId).IsUnique();
|
||||||
entity.HasIndex(e => e.AgentName);
|
entity.HasIndex(e => e.AgentName).IsUnique();
|
||||||
entity.HasIndex(e => e.TotalPnL);
|
entity.HasIndex(e => e.TotalPnL);
|
||||||
|
|
||||||
// Configure relationship with User
|
// Configure relationship with User
|
||||||
|
|||||||
Reference in New Issue
Block a user