Files
Evergreen-Health/Evergreen.Health.Application/Health/Models/HealthModels.cs
T

98 lines
2.6 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace Evergreen.Health.Application.Health.Models;
public sealed class HealthRegisterInput
{
[Required, RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号码")]
public string Phone { get; set; } = string.Empty;
[Required, MinLength(8), MaxLength(32)]
public string Password { get; set; } = string.Empty;
[Required, MaxLength(50)]
public string DisplayName { get; set; } = string.Empty;
}
public sealed class HealthLoginInput
{
[Required]
public string Phone { get; set; } = string.Empty;
[Required]
public string Password { get; set; } = string.Empty;
}
public sealed class HealthAuthOutput
{
public string AccessToken { get; set; } = string.Empty;
public string RefreshToken { get; set; } = string.Empty;
public HealthUserOutput User { get; set; } = new();
}
public sealed class HealthUserOutput
{
public long Id { get; set; }
public string Phone { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string? AvatarUrl { get; set; }
}
public sealed class SaveHealthProfileInput
{
public DateTime? Birthday { get; set; }
[MaxLength(20)]
public string? Gender { get; set; }
[Range(80, 250)]
public decimal? HeightCm { get; set; }
[Range(20, 300)]
public decimal? WeightKg { get; set; }
[Range(0, 24)]
public decimal? AverageSleepHours { get; set; }
[Range(0, 1440)]
public int? DailyExerciseMinutes { get; set; }
[MaxLength(500)]
public string? DietPreference { get; set; }
[MaxLength(500)]
public string? HealthGoal { get; set; }
}
public sealed class SaveHealthModulesInput
{
[Required, MinLength(1)]
public List<string> ModuleCodes { get; set; } = [];
}
public sealed class HealthPlanItemOutput
{
public string ModuleCode { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Target { get; set; } = string.Empty;
public string Advice { get; set; } = string.Empty;
}
public sealed class HealthPlanOutput
{
public long Id { get; set; }
public int Version { get; set; }
public string Title { get; set; } = string.Empty;
public string Summary { get; set; } = string.Empty;
public DateTime CreateTime { get; set; }
public List<HealthPlanItemOutput> Items { get; set; } = [];
}
public sealed class HealthDashboardOutput
{
public HealthUserOutput User { get; set; } = new();
public SaveHealthProfileInput? Profile { get; set; }
public List<string> SelectedModules { get; set; } = [];
public HealthPlanOutput? CurrentPlan { get; set; }
}