57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using DramaLing.Api.Utils;
|
|
|
|
namespace DramaLing.Api.Models.Entities;
|
|
|
|
public class User
|
|
{
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(50)]
|
|
public string Username { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[EmailAddress]
|
|
[MaxLength(255)]
|
|
public string Email { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[MaxLength(255)]
|
|
public string PasswordHash { get; set; } = string.Empty;
|
|
|
|
[MaxLength(100)]
|
|
public string? DisplayName { get; set; }
|
|
|
|
public string? AvatarUrl { get; set; }
|
|
|
|
[MaxLength(20)]
|
|
public string SubscriptionType { get; set; } = "free";
|
|
|
|
public Dictionary<string, object> Preferences { get; set; } = new();
|
|
|
|
[MaxLength(10)]
|
|
public string EnglishLevel { get; set; } = "A2"; // A1, A2, B1, B2, C1, C2
|
|
|
|
/// <summary>
|
|
/// CEFR 英文程度等級 (數字格式: 0=未知, 1=A1, 2=A2, 3=B1, 4=B2, 5=C1, 6=C2)
|
|
/// </summary>
|
|
public int EnglishLevelNumeric { get; set; } = 2; // 預設 A2
|
|
|
|
public DateTime LevelUpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public bool IsLevelVerified { get; set; } = false; // 是否通過測試驗證
|
|
|
|
[MaxLength(500)]
|
|
public string? LevelNotes { get; set; } // 程度設定備註
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// Navigation Properties
|
|
public virtual ICollection<Flashcard> Flashcards { get; set; } = new List<Flashcard>();
|
|
public virtual UserSettings? Settings { get; set; }
|
|
// StudySession collection removed
|
|
public virtual ICollection<ErrorReport> ErrorReports { get; set; } = new List<ErrorReport>();
|
|
public virtual ICollection<DailyStats> DailyStats { get; set; } = new List<DailyStats>();
|
|
} |