From 262e7d63969e3d1cdda5ef7dd22459ee308a5c0f Mon Sep 17 00:00:00 2001 From: SpecialX <47072643+wangxiner55@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:21:29 +0800 Subject: [PATCH] FixAuth --- Entities/Contracts/ClassTeacher.cs | 2 + Entities/Contracts/User.cs | 2 + TechHelper.Client/Exam/ExamStruct.cs | 6 +- TechHelper.Client/Exam/QuestionSimple.cs | 36 - .../HttpInterceptorHandlerService.cs | 38 +- .../AuthenticationClientService.cs | 11 +- .../HttpRepository/RefreshTokenService.cs | 11 +- .../HttpRepository/RefreshTokenService2.cs | 46 - .../Pages/Exam/AssignmentDetailView.razor | 10 + .../Pages/Exam/QuestionDetailView.razor | 9 + TechHelper.Client/Pages/Manage/Class.razor.cs | 1 + TechHelper.Client/Program.cs | 1 - TechHelper.Client/Services/ClasssServices.cs | 9 +- TechHelper.Client/Services/ExamService.cs | 8 +- .../ClassTeacherConfiguration.cs | 2 +- .../Migrations/20250625032845_up.Designer.cs | 1238 +++++++++++++++++ .../Migrations/20250625032845_up.cs | 95 ++ .../ApplicationContextModelSnapshot.cs | 8 +- .../Services/AuthenticationService.cs | 13 +- TechHelper.Server/Services/ClassService.cs | 96 +- TechHelper.Server/Services/IClassService.cs | 1 + 21 files changed, 1491 insertions(+), 152 deletions(-) delete mode 100644 TechHelper.Client/Exam/QuestionSimple.cs delete mode 100644 TechHelper.Client/HttpRepository/RefreshTokenService2.cs create mode 100644 TechHelper.Client/Pages/Exam/AssignmentDetailView.razor create mode 100644 TechHelper.Client/Pages/Exam/QuestionDetailView.razor create mode 100644 TechHelper.Server/Migrations/20250625032845_up.Designer.cs create mode 100644 TechHelper.Server/Migrations/20250625032845_up.cs diff --git a/Entities/Contracts/ClassTeacher.cs b/Entities/Contracts/ClassTeacher.cs index 3434624..5b1e5ab 100644 --- a/Entities/Contracts/ClassTeacher.cs +++ b/Entities/Contracts/ClassTeacher.cs @@ -14,11 +14,13 @@ namespace Entities.Contracts [Key] [Column("class_id")] public Guid ClassId { get; set; } + [ForeignKey(nameof(ClassId))] public Class Class { get; set; } [Key] [Column("teacher_id")] public Guid TeacherId { get; set; } + [ForeignKey(nameof(TeacherId))] public User Teacher { get; set; } [Column("subject_taught")] diff --git a/Entities/Contracts/User.cs b/Entities/Contracts/User.cs index 52352db..4054383 100644 --- a/Entities/Contracts/User.cs +++ b/Entities/Contracts/User.cs @@ -21,7 +21,9 @@ namespace Entities.Contracts [Column("deleted")] public bool IsDeleted { get; set; } + [InverseProperty(nameof(ClassTeacher.Teacher))] public ICollection TaughtClassesLink { get; set; } + [InverseProperty(nameof(ClassStudent.Student))] public ICollection EnrolledClassesLink { get; set; } public ICollection CreatedQuestions { get; set; } diff --git a/TechHelper.Client/Exam/ExamStruct.cs b/TechHelper.Client/Exam/ExamStruct.cs index 7ecdd33..9e36b90 100644 --- a/TechHelper.Client/Exam/ExamStruct.cs +++ b/TechHelper.Client/Exam/ExamStruct.cs @@ -24,9 +24,9 @@ namespace TechHelper.Client.Exam public class QuestionAnswerStatus { - public string QuestionSequence { get; set; } = string.Empty; // 题目序号,例如 "1.1" - public string QuestionText { get; set; } = string.Empty; // 题目文本 - public float QuestionScore { get; set; } // 题目分值 + public string QuestionSequence { get; set; } = string.Empty; // 题目序号,例如 "1.1" + public string QuestionText { get; set; } = string.Empty; // 题目文本 + public float QuestionScore { get; set; } // 题目分值 public Dictionary StudentCorrectStatus { get; set; } = new Dictionary(); // Key: Student.Id, Value: true 表示正确,false 表示错误 } diff --git a/TechHelper.Client/Exam/QuestionSimple.cs b/TechHelper.Client/Exam/QuestionSimple.cs deleted file mode 100644 index da098b6..0000000 --- a/TechHelper.Client/Exam/QuestionSimple.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Xml.Serialization; - -namespace TechHelper.Client.Exam.QuestionSimple -{ - - [XmlRoot("QG")] - public class QuestionGroup - { - [XmlElement("T")] - public string Title { get; set; } - [XmlElement("QR")] - public string QuestionReference { get; set; } = ""; - [XmlArray("SQs")] - [XmlArrayItem("SQ")] - public List SubQuestions { get; set; } = new List(); - [XmlArray("SQGs")] - [XmlArrayItem("QG")] - public List SubQuestionGroups { get; set; } = new List(); - } - public class SubQuestion - { - [XmlElement("T")] - public string Stem { get; set; } - [XmlArray("Os")] - [XmlArrayItem("O")] - public List