feat: refactor week number handling to use WeekDefinitionId across multiple entities and queries
This commit is contained in:
+10
-4
@@ -15,8 +15,7 @@ public class WorkerExecutionLogConfiguration : IEntityTypeConfiguration<WorkerEx
|
||||
builder.Property(x => x.ExecutionId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.WeekNumber)
|
||||
.HasMaxLength(10)
|
||||
builder.Property(x => x.WeekDefinitionId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.StartedAt)
|
||||
@@ -31,8 +30,15 @@ public class WorkerExecutionLogConfiguration : IEntityTypeConfiguration<WorkerEx
|
||||
builder.Property(x => x.Details)
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
// Index for querying by week
|
||||
builder.HasIndex(x => x.WeekNumber);
|
||||
// رابطه با WeekDefinition (Required FK)
|
||||
builder.HasOne(x => x.WeekDefinition)
|
||||
.WithMany(wd => wd.WorkerExecutionLogs)
|
||||
.HasForeignKey(x => x.WeekDefinitionId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
// Index for querying by WeekDefinitionId
|
||||
builder.HasIndex(x => x.WeekDefinitionId);
|
||||
|
||||
// Index for querying by execution time
|
||||
builder.HasIndex(x => x.StartedAt);
|
||||
|
||||
Reference in New Issue
Block a user