feat: refactor week number handling to use WeekDefinitionId across multiple entities and queries

This commit is contained in:
masoodafar-web
2025-12-19 10:41:22 +03:30
parent 3cb95dc349
commit 8b784101be
83 changed files with 17592 additions and 566 deletions
@@ -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);