using System.ComponentModel.DataAnnotations; namespace Apimanager_backend.Models { public class User { /// /// 用户ID,主键,自增 /// public int Id { get; set; } /// /// 用户名,唯一 /// [Required] public string Username { get; set; } // varchar(20) /// /// 邮箱,唯一 /// public string Email { get; set; } // varchar(20) /// /// 密码哈希 /// [Required] [MaxLength(255)] public string PassHash { get; set; } // varchar(255) /// /// 用户角色 /// //public UserRole Role { get; set; } // Enum('Admin','User') /// /// 是否禁用 /// public bool IsBan { get; set; } = false; // boolean /// /// 是否删除 /// public bool IsDelete { get; set; } = false; // boolean /// /// 余额 /// public decimal Balance { get; set; } = 0; // Decimal(10) /// /// 创建时间,默认当前时间 /// public DateTime CreatedAt { get; set; } = DateTime.UtcNow; // Timestamp //导航属性 public ICollection Packages { get; set; } public ICollection operationLogs { get; set; } public ICollection CallLogs { get; set; } public ICollection Orders { get; set; } public ICollection Roles { get; set; } = new List(); } }