using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class AppraisalConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(a => a.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(a => a.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId); builder.Property(a => a.LastRating).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(a => a.AppraisalType).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(a => a.AppraisalNote).HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(a => a.Status).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(a => a.CurrentSalary).HasColumnType("decimal(18,2)"); builder.Property(a => a.IncrementPercentage).HasColumnType("decimal(18,2)"); builder.Property(a => a.NewSalary).HasColumnType("decimal(18,2)"); builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique(); builder.HasIndex(a => a.EmployeeId); builder.HasOne(a => a.Employee) .WithMany() .HasForeignKey(a => a.EmployeeId) .OnDelete(DeleteBehavior.NoAction); } }