学业预警
This commit is contained in:
@@ -60,6 +60,8 @@ public sealed class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
public DbSet<DeferredExam> DeferredExams => Set<DeferredExam>();
|
||||
public DbSet<GradeModification> GradeModifications => Set<GradeModification>();
|
||||
public DbSet<CourseSubstitution> CourseSubstitutions => Set<CourseSubstitution>();
|
||||
public DbSet<WarningRule> WarningRules => Set<WarningRule>();
|
||||
public DbSet<WarningRecord> WarningRecords => Set<WarningRecord>();
|
||||
public DbSet<Notification> Notifications => Set<Notification>();
|
||||
public DbSet<StudentStatusChange> StudentStatusChanges =>
|
||||
Set<StudentStatusChange>();
|
||||
@@ -709,6 +711,26 @@ public sealed class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
entity.HasOne(x => x.GradeRecord).WithMany()
|
||||
.HasForeignKey(x => x.GradeRecordId).OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
builder.Entity<WarningRule>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Name).HasMaxLength(100);
|
||||
entity.Property(x => x.Threshold).HasPrecision(7, 2);
|
||||
entity.Property(x => x.Description).HasMaxLength(300);
|
||||
entity.HasIndex(x => new { x.AcademicTermId, x.Type }).IsUnique();
|
||||
entity.HasOne(x => x.AcademicTerm).WithMany()
|
||||
.HasForeignKey(x => x.AcademicTermId).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
builder.Entity<WarningRecord>(entity =>
|
||||
{
|
||||
entity.Property(x => x.TriggerValue).HasPrecision(7, 2);
|
||||
entity.Property(x => x.Detail).HasMaxLength(1000);
|
||||
entity.Property(x => x.AcknowledgeComment).HasMaxLength(300);
|
||||
entity.HasIndex(x => new { x.StudentId, x.AcademicTermId, x.Type }).IsUnique();
|
||||
entity.HasIndex(x => x.Status);
|
||||
entity.HasOne(x => x.Student).WithMany()
|
||||
.HasForeignKey(x => x.StudentId).OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
builder.Entity<CourseSubstitution>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Reason).HasMaxLength(500);
|
||||
|
||||
Reference in New Issue
Block a user