25 lines
973 B
C#
25 lines
973 B
C#
using Baya.Domain.Entities.Booking;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Baya.Infrastructure.Persistence.Configuration.BookingConfig;
|
|
|
|
internal sealed class BookingCareInstructionConfig : IEntityTypeConfiguration<BookingCareInstruction>
|
|
{
|
|
public void Configure(EntityTypeBuilder<BookingCareInstruction> builder)
|
|
{
|
|
builder.ToTable("BookingCareInstructions", "booking");
|
|
|
|
// All clinical fields are encrypted at rest (converters wired in ApplicationDbContext) and are
|
|
// nvarchar(max); shorter contact fields still ride the same seam, so no length cap here.
|
|
|
|
// 1:1 with the booking (UNIQUE index created automatically).
|
|
builder.HasOne(c => c.Booking)
|
|
.WithOne(b => b.CareInstructions)
|
|
.HasForeignKey<BookingCareInstruction>(c => c.BookingId)
|
|
.IsRequired();
|
|
|
|
builder.HasQueryFilter(c => c.DeletedAt == null);
|
|
}
|
|
}
|