初始化
This commit is contained in:
115
FutureMailAPI/DTOs/MailDTOs.cs
Normal file
115
FutureMailAPI/DTOs/MailDTOs.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace FutureMailAPI.DTOs
|
||||
{
|
||||
public class SentMailCreateDto
|
||||
{
|
||||
[Required(ErrorMessage = "标题是必填项")]
|
||||
[StringLength(200, ErrorMessage = "标题长度不能超过200个字符")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[Required(ErrorMessage = "内容是必填项")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
// 收件人类型: 0-自己, 1-指定用户, 2-公开时间胶囊
|
||||
[Required(ErrorMessage = "收件人类型是必填项")]
|
||||
[Range(0, 2, ErrorMessage = "收件人类型必须是0、1或2")]
|
||||
public int RecipientType { get; set; }
|
||||
|
||||
// 如果是指定用户,提供用户邮箱
|
||||
public string? RecipientEmail { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "投递时间是必填项")]
|
||||
public DateTime DeliveryTime { get; set; }
|
||||
|
||||
// 触发条件类型: 0-时间, 1-地点, 2-事件
|
||||
[Required(ErrorMessage = "触发条件类型是必填项")]
|
||||
[Range(0, 2, ErrorMessage = "触发条件类型必须是0、1或2")]
|
||||
public int TriggerType { get; set; } = 0;
|
||||
|
||||
// 触发条件详情(JSON格式)
|
||||
public string? TriggerDetails { get; set; }
|
||||
|
||||
// 附件路径(JSON数组格式)
|
||||
public string? Attachments { get; set; }
|
||||
|
||||
// 是否加密
|
||||
public bool IsEncrypted { get; set; } = false;
|
||||
|
||||
// 加密密钥(如果使用端到端加密)
|
||||
public string? EncryptionKey { get; set; }
|
||||
|
||||
// 邮件主题/胶囊皮肤
|
||||
[StringLength(50, ErrorMessage = "主题长度不能超过50个字符")]
|
||||
public string? Theme { get; set; }
|
||||
}
|
||||
|
||||
public class SentMailUpdateDto
|
||||
{
|
||||
[StringLength(200, ErrorMessage = "标题长度不能超过200个字符")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
public string? Content { get; set; }
|
||||
|
||||
public DateTime? DeliveryTime { get; set; }
|
||||
|
||||
public string? TriggerDetails { get; set; }
|
||||
|
||||
public string? Attachments { get; set; }
|
||||
|
||||
public string? Theme { get; set; }
|
||||
}
|
||||
|
||||
public class SentMailResponseDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public int SenderId { get; set; }
|
||||
public string SenderUsername { get; set; } = string.Empty;
|
||||
public int RecipientType { get; set; }
|
||||
public int? RecipientId { get; set; }
|
||||
public string? RecipientUsername { get; set; }
|
||||
public DateTime SentAt { get; set; }
|
||||
public DateTime DeliveryTime { get; set; }
|
||||
public int Status { get; set; }
|
||||
public int TriggerType { get; set; }
|
||||
public string? TriggerDetails { get; set; }
|
||||
public string? Attachments { get; set; }
|
||||
public bool IsEncrypted { get; set; }
|
||||
public string? Theme { get; set; }
|
||||
|
||||
// 计算属性
|
||||
public string StatusText { get; set; } = string.Empty;
|
||||
public string RecipientTypeText { get; set; } = string.Empty;
|
||||
public string TriggerTypeText { get; set; } = string.Empty;
|
||||
public int DaysUntilDelivery { get; set; }
|
||||
}
|
||||
|
||||
public class ReceivedMailResponseDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int SentMailId { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string SenderUsername { get; set; } = string.Empty;
|
||||
public DateTime SentAt { get; set; }
|
||||
public DateTime ReceivedAt { get; set; }
|
||||
public bool IsRead { get; set; }
|
||||
public DateTime? ReadAt { get; set; }
|
||||
public bool IsReplied { get; set; }
|
||||
public int? ReplyMailId { get; set; }
|
||||
public string? Theme { get; set; }
|
||||
}
|
||||
|
||||
public class MailListQueryDto
|
||||
{
|
||||
public int PageIndex { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
public int? Status { get; set; }
|
||||
public int? RecipientType { get; set; }
|
||||
public string? Keyword { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user