Skip to content

Commit

Permalink
Replacing common migration with separate migrations, and adjusting th…
Browse files Browse the repository at this point in the history
…e Forecast model
  • Loading branch information
astride committed Jan 9, 2025
1 parent 799b56e commit 2d73cb0
Show file tree
Hide file tree
Showing 7 changed files with 675 additions and 35 deletions.
3 changes: 1 addition & 2 deletions backend/Core/Forecasts/Forecast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public class Forecast
public required int ConsultantId { get; set; }
public required Consultant Consultant { get; set; }

public DateOnly MonthYear { get; set; }
public required DateOnly MonthYear { get; set; }

public int OriginalValue { get; set; }
public int? AdjustedValue { get; set; }
}
9 changes: 4 additions & 5 deletions backend/Infrastructure/DatabaseContext/ApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMany(consultant => consultant.PlannedAbsences)
.WithOne(absence => absence.Consultant);

modelBuilder.Entity<Consultant>()
.HasMany(c => c.Forecasts)
.WithOne(f => f.Consultant);

modelBuilder.Entity<Consultant>()
.Property(v => v.Degree)
.HasConversion<string>();
Expand Down Expand Up @@ -204,11 +208,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
GraduationYear = 2019
});

modelBuilder.Entity<Forecast>()
.HasOne<Consultant>(f => f.Consultant)
.WithMany(c => c.Forecasts)
.HasForeignKey(f => f.ConsultantId);

base.OnModelCreating(modelBuilder);
}
}
Loading

0 comments on commit 2d73cb0

Please sign in to comment.