87 lines
2.9 KiB
C#
87 lines
2.9 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using DramaLing.Api.Utils;
|
|
|
|
namespace DramaLing.Api.Models.DTOs;
|
|
|
|
public class ExampleImageDto
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
public string ImageUrl { get; set; } = string.Empty;
|
|
public bool IsPrimary { get; set; }
|
|
public decimal? QualityScore { get; set; }
|
|
public int? FileSize { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
}
|
|
|
|
public class CreateFlashcardRequest
|
|
{
|
|
[Required(ErrorMessage = "詞彙為必填項目")]
|
|
[StringLength(255, ErrorMessage = "詞彙長度不得超過 255 字元")]
|
|
public string Word { get; set; } = string.Empty;
|
|
|
|
[Required(ErrorMessage = "翻譯為必填項目")]
|
|
public string Translation { get; set; } = string.Empty;
|
|
|
|
[Required(ErrorMessage = "定義為必填項目")]
|
|
public string Definition { get; set; } = string.Empty;
|
|
|
|
[StringLength(255, ErrorMessage = "發音長度不得超過 255 字元")]
|
|
public string Pronunciation { get; set; } = string.Empty;
|
|
|
|
[RegularExpression("^(noun|verb|adjective|adverb|preposition|interjection|phrase)$",
|
|
ErrorMessage = "詞性必須為有效值")]
|
|
public string PartOfSpeech { get; set; } = "noun";
|
|
|
|
[Required(ErrorMessage = "例句為必填項目")]
|
|
public string Example { get; set; } = string.Empty;
|
|
|
|
public string? ExampleTranslation { get; set; }
|
|
|
|
// 雙軌制難度等級 - 支援字串和數字格式
|
|
[Range(0, 6, ErrorMessage = "難度等級必須在 0-6 之間")]
|
|
public int DifficultyLevelNumeric { get; set; } = 2; // 預設 A2 = 2
|
|
|
|
// 向後相容的字串格式,會自動從 DifficultyLevelNumeric 計算
|
|
}
|
|
|
|
public class UpdateFlashcardRequest : CreateFlashcardRequest
|
|
{
|
|
// 繼承所有創建請求的欄位,用於更新操作
|
|
}
|
|
|
|
public class FlashcardResponse
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Word { get; set; } = string.Empty;
|
|
public string Translation { get; set; } = string.Empty;
|
|
public string Definition { get; set; } = string.Empty;
|
|
public string? PartOfSpeech { get; set; }
|
|
public string? Pronunciation { get; set; }
|
|
public string? Example { get; set; }
|
|
public string? ExampleTranslation { get; set; }
|
|
public int MasteryLevel { get; set; }
|
|
public int TimesReviewed { get; set; }
|
|
public bool IsFavorite { get; set; }
|
|
public DateTime NextReviewDate { get; set; }
|
|
|
|
// 雙軌制難度等級 - API 回應同時提供兩種格式
|
|
public int DifficultyLevelNumeric { get; set; }
|
|
public string? DifficultyLevel { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime? UpdatedAt { get; set; }
|
|
}
|
|
|
|
public class BatchFavoriteRequest
|
|
{
|
|
[Required]
|
|
public List<Guid> FlashcardIds { get; set; } = new();
|
|
|
|
public bool IsFavorite { get; set; }
|
|
}
|
|
|
|
public class BatchDeleteRequest
|
|
{
|
|
[Required]
|
|
public List<Guid> FlashcardIds { get; set; } = new();
|
|
} |