using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class PromotionConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(p => p.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(p => p.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId); builder.Property(p => p.FromGrade).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(p => p.ToGrade).HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(p => p.PromotionNote).HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(p => p.Status).HasMaxLength(GlobalConsts.StringLengthShort); builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique(); builder.HasIndex(p => p.EmployeeId); builder.HasOne(p => p.Employee) .WithMany() .HasForeignKey(p => p.EmployeeId) .OnDelete(DeleteBehavior.NoAction); } }