using Domain.Entities.Developers; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Developers; public class ApiPersonalAccessTokenConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasOne(x => x.Owner).WithMany().HasForeignKey(x => x.OwnerMemberID).OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => x.TokenHash).IsUnique(); builder.HasIndex(x => x.OwnerMemberID); builder.ToTable(nameof(ApiPersonalAccessToken), x => x.HasComment("Personal Access Token (PAT)")); builder.HasKey(x => x.ID); builder.Property(x => x.Name).HasMaxLength(100).IsRequired(); builder.Property(x => x.TokenHash).HasMaxLength(256).IsRequired(); builder.Property(x => x.TokenHint).HasMaxLength(4).IsRequired(); builder.Property(x => x.ScopesCsv).HasMaxLength(1024); builder.Property(x => x.CreatedAt).IsRequired(); } }