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;
|
||||
|
||||
[Table("AgentSummaries")]
|
||||
[Index(nameof(AgentName), IsUnique = true)]
|
||||
[Index(nameof(UserId), IsUnique = true)]
|
||||
public class AgentSummaryEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string AgentName { get; set; }
|
||||
[Key]
|
||||
[Required] public int Id { 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 TotalROI { 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.TotalVolume).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();
|
||||
|
||||
// Create indexes for common queries
|
||||
entity.HasIndex(e => e.UserId).IsUnique();
|
||||
entity.HasIndex(e => e.AgentName);
|
||||
entity.HasIndex(e => e.AgentName).IsUnique();
|
||||
entity.HasIndex(e => e.TotalPnL);
|
||||
|
||||
// Configure relationship with User
|
||||
|
||||
Reference in New Issue
Block a user