初始化

This commit is contained in:
2025-10-18 16:18:20 +08:00
parent cf2273e6da
commit e287d7bbde
33 changed files with 3575 additions and 303 deletions

View File

@@ -189,4 +189,130 @@ namespace FutureMailAPI.DTOs
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
// 存入胶囊请求DTO
public class SaveToCapsuleDto
{
[Required(ErrorMessage = "标题是必填项")]
[StringLength(200, ErrorMessage = "标题长度不能超过200个字符")]
public string Title { get; set; } = string.Empty;
[Required(ErrorMessage = "内容是必填项")]
public string Content { get; set; } = string.Empty;
[Required(ErrorMessage = "收件人类型是必填项")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public RecipientTypeEnum RecipientType { get; set; }
public string? RecipientEmail { get; set; }
public DateTime? SendTime { get; set; }
[Required(ErrorMessage = "触发条件类型是必填项")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public TriggerTypeEnum TriggerType { get; set; } = TriggerTypeEnum.TIME;
public object? TriggerCondition { get; set; }
public List<object>? Attachments { get; set; }
public bool IsEncrypted { get; set; } = false;
[Required(ErrorMessage = "胶囊样式是必填项")]
public string CapsuleStyle { get; set; } = "default";
}
// 存入胶囊响应DTO
public class SaveToCapsuleResponseDto
{
public int Id { get; set; }
public string MailId { get; set; } = string.Empty;
public string CapsuleId { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
// 胶囊邮件列表响应DTO
public class CapsuleMailListResponseDto
{
public string MailId { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public UserInfoDto Sender { get; set; } = new();
public UserInfoDto Recipient { get; set; } = new();
public DateTime SendTime { get; set; }
public DateTime? DeliveryTime { get; set; }
public string Status { get; set; } = string.Empty;
public bool HasAttachments { get; set; }
public bool IsEncrypted { get; set; }
public string CapsuleStyle { get; set; } = string.Empty;
public int? Countdown { get; set; } // 倒计时秒数仅status=PENDING时返回
}
// 胶囊邮件详情响应DTO
public class CapsuleMailDetailResponseDto
{
public string MailId { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public UserInfoDto Sender { get; set; } = new();
public UserInfoDto Recipient { get; set; } = new();
public DateTime SendTime { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? DeliveryTime { get; set; }
public string Status { get; set; } = string.Empty;
public string TriggerType { get; set; } = string.Empty;
public object? TriggerCondition { get; set; }
public List<AttachmentDto> Attachments { get; set; } = new();
public bool IsEncrypted { get; set; }
public string CapsuleStyle { get; set; } = string.Empty;
public bool CanEdit { get; set; } // 是否可编辑(仅草稿状态)
public bool CanRevoke { get; set; } // 是否可撤销(仅待投递状态)
}
// 附件DTO
public class AttachmentDto
{
public string Id { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public string? Thumbnail { get; set; }
public long Size { get; set; }
}
// 更新胶囊邮件DTO
public class UpdateCapsuleMailDto
{
public string? Title { get; set; }
public string? Content { get; set; }
public RecipientTypeEnum? RecipientType { get; set; }
public string? RecipientEmail { get; set; }
public DateTime? SendTime { get; set; }
public TriggerTypeEnum? TriggerType { get; set; }
public object? TriggerCondition { get; set; }
public List<object>? Attachments { get; set; }
public bool? IsEncrypted { get; set; }
public string? CapsuleStyle { get; set; }
}
// 发送至未来请求DTO
public class SendToFutureDto
{
[Required(ErrorMessage = "邮件ID是必填项")]
public int MailId { get; set; }
[Required(ErrorMessage = "投递时间是必填项")]
public DateTime DeliveryTime { get; set; }
}
// 发送至未来响应DTO
public class SendToFutureResponseDto
{
public int MailId { get; set; }
public string Title { get; set; } = string.Empty;
public DateTime DeliveryTime { get; set; }
public string Status { get; set; } = string.Empty;
public DateTime SentAt { get; set; }
}
}

View File

@@ -60,6 +60,7 @@ namespace FutureMailAPI.DTOs
public int UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string? Avatar { get; set; }
public string Email { get; set; } = string.Empty;
}
public class SubscriptionResponseDto