重构项目结构,移除Assignment相关功能,优化Submission模块
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
This commit is contained in:
21
Entities/DTO/User/StudentExamDetailDto.cs
Normal file
21
Entities/DTO/User/StudentExamDetailDto.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public record StudentExamDetailDto
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public string? DisplayName { get; init; }
|
||||
|
||||
public uint ErrorQuestionNum { get; init; }
|
||||
public Dictionary<string, uint> ErrorQuestionTypes { get; init; } = new Dictionary<string, uint>();
|
||||
public Dictionary<SubjectAreaEnum, uint> SubjectAreaErrorQuestionDis { get; init; } = new Dictionary<SubjectAreaEnum, uint>();
|
||||
public Dictionary<byte, uint> LessonErrorDis { get; init; } = new Dictionary<byte, uint>();
|
||||
public float Score { get; init; }
|
||||
}
|
||||
}
|
||||
11
Entities/DTO/User/UserClassInfoDto.cs
Normal file
11
Entities/DTO/User/UserClassInfoDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public record UserClassDetailInfoDto(IEnumerable<UserClassInfoDto> UserClassInfos, string School);
|
||||
public record UserClassInfoDto(Guid Id, byte Class, byte Grade);
|
||||
}
|
||||
129
Entities/DTO/User/UserDto.cs
Normal file
129
Entities/DTO/User/UserDto.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户信息数据传输对象
|
||||
/// 用于在API调用中传输用户的基本信息
|
||||
/// </summary>
|
||||
public record UserDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户唯一标识符
|
||||
/// </summary>
|
||||
public Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string? UserName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
[EmailAddress]
|
||||
public string? Email { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[Phone]
|
||||
public string? PhoneNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示名称
|
||||
/// </summary>
|
||||
public string? DisplayName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 家庭住址
|
||||
/// </summary>
|
||||
public string? HomeAddress { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户角色
|
||||
/// </summary>
|
||||
public UserRoles? Role { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 教授科目ID
|
||||
/// </summary>
|
||||
public Guid? TeachSubjectId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 教授科目信息
|
||||
/// </summary>
|
||||
public SubjectDto? TeachSubject { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户加入的班级数量
|
||||
/// </summary>
|
||||
public int JoinedClassCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建的问题数量
|
||||
/// </summary>
|
||||
public int CreatedQuestionsCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建的考试数量
|
||||
/// </summary>
|
||||
public int CreatedExamsCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交的作业数量
|
||||
/// </summary>
|
||||
public int SubmittedAssignmentsCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 批改的作业数量
|
||||
/// </summary>
|
||||
public int GradedAssignmentsCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户创建时间
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户最后更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户是否已验证邮箱
|
||||
/// </summary>
|
||||
public bool EmailConfirmed { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户是否已锁定
|
||||
/// </summary>
|
||||
public bool LockoutEnabled { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户锁定结束时间
|
||||
/// </summary>
|
||||
public DateTime? LockoutEnd { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色的显示名称
|
||||
/// </summary>
|
||||
public string? RoleDisplayName => Role?.GetDisplayName();
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色的简短名称
|
||||
/// </summary>
|
||||
public string? RoleShortName => Role?.GetShortName();
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户的基本信息字符串
|
||||
/// </summary>
|
||||
public string? UserInfoString => $"{DisplayName ?? UserName} ({Email})";
|
||||
}
|
||||
}
|
||||
17
Entities/DTO/User/UserForAdmin.cs
Normal file
17
Entities/DTO/User/UserForAdmin.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public record UserForAdmin
|
||||
{
|
||||
public string Email { get; init; }
|
||||
public string SchoolName { get; init; }
|
||||
public string Password { get; init; }
|
||||
public string DisplayName { get; init; }
|
||||
public string Address { get; init; }
|
||||
}
|
||||
}
|
||||
43
Entities/DTO/User/UserForRegistrationDto.cs
Normal file
43
Entities/DTO/User/UserForRegistrationDto.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public class UserForRegistrationDto
|
||||
{
|
||||
[Required(ErrorMessage = "姓名是必填项。")]
|
||||
[StringLength(50, MinimumLength = 2, ErrorMessage = "姓名长度必须在 2 到 50 个字符之间。")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "电子邮件是必填项。")]
|
||||
[EmailAddress(ErrorMessage = "电子邮件格式不正确。")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "密码是必填项。")]
|
||||
[StringLength(100, MinimumLength = 6, ErrorMessage = "密码长度至少为 6 个字符。")]
|
||||
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&.])[A-Za-z\d@$!%*?&.]{6,}$",
|
||||
ErrorMessage = "密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符。特殊字符包含 @$!%*?&. ")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Compare(nameof(Password), ErrorMessage = "密码和确认密码不匹配。")]
|
||||
[Required(ErrorMessage = "确认密码是必填项。")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "至少选择一个角色。")]
|
||||
public UserRoles Roles { get; set; } = UserRoles.Student;
|
||||
|
||||
[Phone(ErrorMessage = "电话号码格式不正确。")]
|
||||
[StringLength(11, MinimumLength = 11, ErrorMessage = "电话号码必须是 11 位数字。")]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
[StringLength(200, ErrorMessage = "家庭住址不能超过 200 个字符。")]
|
||||
public string? HomeAddress { get; set; }
|
||||
|
||||
public RegisterUserToClassDto RegisterUserToClassDto { get; set; } = new RegisterUserToClassDto();
|
||||
}
|
||||
}
|
||||
11
Entities/DTO/User/UserListDto.cs
Normal file
11
Entities/DTO/User/UserListDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public record UserListDto (Guid Id, string DisplayName, UserRoles Role, string Email, SubjectDto TeachSubject);
|
||||
}
|
||||
18
Entities/DTO/User/UserRegistrationToClassDto.cs
Normal file
18
Entities/DTO/User/UserRegistrationToClassDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public class UserRegistrationToClassDto
|
||||
{
|
||||
public string User { get; set; } = string.Empty;
|
||||
public byte ClassId { get; set; }
|
||||
public byte GradeId { get; set; }
|
||||
public UserRoles Roles { get; set; } = UserRoles.Student;
|
||||
public SubjectAreaEnum SubjectArea { get; set; } = SubjectAreaEnum.Unknown;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user