using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class EvaluationConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(e => e.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.EvaluatorId).HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.Period).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.FinalScore).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Rating).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.EvaluationNote).HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(e => e.Status).HasMaxLength(GlobalConsts.StringLengthShort); builder.HasIndex(e => e.AutoNumber).IsUnique(); builder.HasIndex(e => e.EmployeeId); builder.HasIndex(e => e.EvaluatorId); builder.HasOne(e => e.Employee) .WithMany() .HasForeignKey(e => e.EmployeeId) .OnDelete(DeleteBehavior.NoAction); builder.HasOne(e => e.Evaluator) .WithMany() .HasForeignKey(e => e.EvaluatorId) .OnDelete(DeleteBehavior.NoAction); } }