using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class BookingConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(e => e.Subject) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AutoNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.StartTimezone) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.EndTimezone) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Location) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Description) .HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(e => e.RecurrenceRule) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.RecurrenceID) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.FollowingID) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.RecurrenceException) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.BookingResourceId) .HasMaxLength(GlobalConsts.StringLengthId); builder.HasOne(e => e.BookingResource) .WithMany() .HasForeignKey(e => e.BookingResourceId) .OnDelete(DeleteBehavior.NoAction); builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique(); builder.HasIndex(e => e.BookingResourceId); } }