添加项目文件。

This commit is contained in:
SpecialX
2025-05-23 19:03:00 +08:00
parent 6fa7679fd3
commit d36fef2bbb
185 changed files with 13413 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("assignments")]
public class Assignment
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("title")]
[StringLength(255)]
public string Title { get; set; }
[Column("description")]
public string Description { get; set; }
[Required]
[Column("due_date")]
public DateTime DueDate { get; set; }
[Column("total_points")]
public decimal? TotalPoints { get; set; }
[Column("created_by")]
[ForeignKey("Creator")]
public Guid CreatedBy { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public User Creator { get; set; }
public ICollection<AssignmentClass> AssignmentClasses { get; set; }
public ICollection<AssignmentGroup> AssignmentGroups { get; set; }
public ICollection<AssignmentAttachment> AssignmentAttachments { get; set; }
public ICollection<Submission> Submissions { get; set; }
public Assignment()
{
Id = Guid.NewGuid();
Submissions = new HashSet<Submission>();
AssignmentGroups = new HashSet<AssignmentGroup>();
AssignmentClasses = new HashSet<AssignmentClass>();
AssignmentAttachments = new HashSet<AssignmentAttachment>();
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
namespace Entities.Contracts
{
[Table("assignment_attachments")]
public class AssignmentAttachment
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("assignment_id")]
[ForeignKey("Assignment")]
public Guid AssignmentId { get; set; }
[Required]
[Column("file_path")]
[StringLength(255)]
public string FilePath { get; set; }
[Required]
[Column("file_name")]
[StringLength(255)]
public string FileName { get; set; }
[Column("uploaded_at")]
public DateTime UploadedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public Assignment Assignment { get; set; }
public AssignmentAttachment()
{
Id = Guid.NewGuid();
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("assignment_class")]
public class AssignmentClass
{
[Key]
[Column("assignment_id", Order = 0)]
[ForeignKey("Assignment")]
public Guid AssignmentId { get; set; }
[Key]
[Column("class_id", Order = 1)]
[ForeignKey("Class")]
public Guid ClassId { get; set; }
[Column("assigned_at")]
public DateTime AssignedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public Assignment Assignment { get; set; }
public Class Class { get; set; }
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("assignment_group")]
public class AssignmentGroup
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("assignment")]
[ForeignKey("Assignment")]
public Guid AssignmentId { get; set; }
[Required]
[Column("title")]
[MaxLength(65535)]
public string Title { get; set; }
[Column("descript")]
[MaxLength(65535)]
public string Descript { get; set; }
[Column("total_points")]
public decimal? TotalPoints { get; set; }
[Column("number")]
public byte Number { get; set; }
[Column("parent_group")]
public Guid? ParentGroup { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public Assignment Assignment { get; set; }
public AssignmentGroup ParentAssignmentGroup { get; set;}
public ICollection<AssignmentGroup> ChildAssignmentGroups { get; set; }
public ICollection<AssignmentQuestion> AssignmentQuestions { get; set; }
public AssignmentGroup()
{
Id = Guid.NewGuid();
ChildAssignmentGroups = new HashSet<AssignmentGroup>();
AssignmentQuestions = new HashSet<AssignmentQuestion>();
}
}
}

View File

@@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("assignment_questions")]
public class AssignmentQuestion
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("question_id")]
[ForeignKey("Question")]
public Guid QuestionId { get; set; }
[Required]
[Column("question_number")]
public uint QuestionNumber { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Required]
[Column("detail_id")]
[ForeignKey("AssignmentGroup")]
public Guid AssignmentGroupId { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
public Question Question { get; set; }
public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
public AssignmentGroup AssignmentGroup { get; set; }
public AssignmentQuestion()
{
Id = Guid.NewGuid();
SubmissionDetails = new HashSet<SubmissionDetail>();
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("classes")]
public class Class
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Column("grade")]
public byte Grade { get; set; }
[Column("class")]
public byte Number { get; set; }
[Column("description")]
public string Description { get; set; }
[Column("head_teacher_id")]
public Guid? HeadTeacherId { get; set; }
public User HeadTeacher { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public ICollection<ClassTeacher> ClassTeachers { get; set; }
public ICollection<ClassStudent> ClassStudents { get; set; }
public ICollection<AssignmentClass> AssignmentClasses { get; set; }
public Class()
{
Id = Guid.NewGuid();
Grade = 0;
Number = 0;
ClassStudents = new HashSet<ClassStudent>();
ClassTeachers = new HashSet<ClassTeacher>();
AssignmentClasses = new HashSet<AssignmentClass>();
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("class_student")]
public class ClassStudent
{
[Key]
[Column("class_id", Order = 0)]
[ForeignKey("Class")]
public Guid ClassId { get; set; }
[Key]
[Column("student_id", Order = 1)]
[ForeignKey("Student")]
public Guid StudentId { get; set; }
[Column("enrollment_date")]
public DateTime EnrollmentDate { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public Class Class { get; set; }
public User Student { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("class_teachers")]
public class ClassTeacher
{
[Key]
[Column("class_id")]
public Guid ClassId { get; set; }
public Class Class { get; set; }
[Key]
[Column("teacher_id")]
public Guid TeacherId { get; set; }
public User Teacher { get; set; }
[Column("subject_taught")]
public string SubjectTaught { get; set; }
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("questions")]
public class Question
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("question_text")]
[MaxLength(65535)]
public string QuestionText { get; set; }
[Required]
[Column("question_type")]
[MaxLength(20)]
public QuestionType QuestionType { get; set; }
[Column("correct_answer")]
[MaxLength(65535)]
public string CorrectAnswer { get; set; }
[Column("difficulty_level")]
[MaxLength(10)]
public DifficultyLevel DifficultyLevel { get; set; }
[Column("subject_area")]
public SubjectAreaEnum SubjectArea { get; set; }
[Required]
[Column("created_by")]
[ForeignKey("Creator")]
public Guid CreatedBy { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public User Creator { get; set; }
public ICollection<AssignmentQuestion> AssignmentQuestions { get; set; }
public Question()
{
Id = Guid.NewGuid();
AssignmentQuestions = new HashSet<AssignmentQuestion>();
}
}
public enum DifficultyLevel
{
easy,
medium,
hard
}
public enum QuestionType
{
Unknown, // 可以有一个未知类型或作为默认
Spelling, // 拼写
Pronunciation, // 给带点字选择正确读音
WordFormation, // 组词
FillInTheBlanks, // 选词填空 / 补充词语
SentenceDictation, // 默写句子
SentenceRewriting, // 仿句 / 改写句子
ReadingComprehension, // 阅读理解
Composition // 作文
// ... 添加您其他题目类型
}
public enum SubjectAreaEnum // 建议命名为 SubjectAreaEnum 以避免与属性名冲突
{
Unknown, // 未知或默认
Mathematics, // 数学
Physics, // 物理
Chemistry, // 化学
Biology, // 生物
History, // 历史
Geography, // 地理
Literature, // 语文/文学
English, // 英语
ComputerScience, // 计算机科学
// ... 你可以根据需要添加更多科目
}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace Entities.Contracts
{
[Table("submissions")]
public class Submission
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("assignment_id")]
[ForeignKey("Assignment")]
public Guid AssignmentId { get; set; }
[Required]
[Column("student_id")]
[ForeignKey("Student")]
public Guid StudentId { get; set; }
[Required]
[Column("attempt_number")]
public Guid AttemptNumber { get; set; }
[Column("submission_time")]
public DateTime SubmissionTime { get; set; }
[Column("overall_grade")]
[Precision(5, 2)]
public decimal? OverallGrade { get; set; }
[Column("overall_feedback")]
public string OverallFeedback { get; set; }
[Column("graded_by")]
[ForeignKey("Grader")]
public Guid? GradedBy { get; set; }
[Column("graded_at")]
public DateTime? GradedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
[Required]
[Column("status")]
public SubmissionStatus Status { get; set; }
// Navigation Properties
public Assignment Assignment { get; set; }
public User Student { get; set; }
public User Grader { get; set; }
public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
public Submission()
{
Id = Guid.NewGuid();
SubmissionDetails = new HashSet<SubmissionDetail>();
}
}
public enum SubmissionStatus
{
Pending, // 待提交/未开始
Submitted, // 已提交
Graded, // 已批改
Resubmission, // 待重新提交 (如果允许)
Late, // 迟交
Draft, // 草稿
// ... 添加你需要的其他状态
}
}

View File

@@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities.Contracts
{
[Table("submission_details")]
public class SubmissionDetail
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("submission_id")]
[ForeignKey("Submission")]
public Guid SubmissionId { get; set; }
[Required]
[Column("student_id")]
[ForeignKey("User")]
public Guid StudentId { get; set; }
[Required]
[Column("assignment_question_id")]
[ForeignKey("AssignmentQuestion")]
public Guid AssignmentQuestionId { get; set; }
[Column("student_answer")]
public string StudentAnswer { get; set; }
[Column("is_correct")]
public bool? IsCorrect { get; set; }
[Column("points_awarded")]
[Precision(5, 2)]
public decimal? PointsAwarded { get; set; }
[Column("teacher_feedback")]
public string TeacherFeedback { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
// Navigation Properties
public Submission Submission { get; set; }
public User User { get; set; }
public AssignmentQuestion AssignmentQuestion { get; set; }
public SubmissionDetail()
{
Id = Guid.NewGuid();
}
}
}

View File

@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations.Schema;
namespace Entities.Contracts
{
public enum UserRoles
{
Student,
Teacher,
Administrator
}
public class User : IdentityUser<Guid>
{
public string? RefreshToken { get; set; }
public DateTime? RefreshTokenExpiryTime { get; set; }
public string? Address { get; set; }
public string? DisplayName { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
public ICollection<ClassTeacher> TaughtClassesLink { get; set; }
public ICollection<ClassStudent> EnrolledClassesLink { get; set; }
public ICollection<Question> CreatedQuestions { get; set; }
public ICollection<Assignment> CreatedAssignments { get; set; }
public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
public ICollection<Submission> SubmissionsAsStudent { get; set; }
public ICollection<Submission> GradedSubmissions { get; set; }
public User()
{
Id = Guid.NewGuid();
SecurityStamp = Guid.NewGuid().ToString();
CreatedQuestions = new HashSet<Question>();
TaughtClassesLink = new HashSet<ClassTeacher>();
EnrolledClassesLink = new HashSet<ClassStudent>();
CreatedAssignments = new HashSet<Assignment>();
GradedSubmissions = new HashSet<Submission>();
SubmissionsAsStudent = new HashSet<Submission>();
}
}
}