< Summary - Estud

Information
Class: Estud.Back.Database.Identity.EstudRoleDbConfig
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Database/Identity/EstudRoleDbConfig.cs
Tag: 114_29044117136
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 34
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Configure(...)100%11100%

File(s)

/home/runner/work/syki/syki/Back/Database/Identity/EstudRoleDbConfig.cs

#LineLine coverage
 1using Estud.Back.Domain.Identity;
 2using Estud.Back.Domain.Institutions;
 3
 4namespace Estud.Back.Database.Identity;
 5
 6public class EstudRoleDbConfig : IEntityTypeConfiguration<EstudRole>
 7{
 8    public void Configure(EntityTypeBuilder<EstudRole> entity)
 9    {
 410        entity.ToTable("roles", DbSchemas.Estud);
 11
 412        entity.HasKey(e => e.Id);
 13
 414        entity.Property(e => e.Permissions)
 415            .HasColumnType("integer[]")
 416            .IsRequired();
 17
 418        entity.HasOne<Institution>()
 419            .WithMany()
 420            .HasPrincipalKey(u => u.Id)
 421            .HasForeignKey(e => e.OwnerId);
 22
 23        // Remove o índice único padrão do ASP.NET Identity
 424        entity.HasIndex(e => e.NormalizedName)
 425            .IsUnique(false)
 426            .HasDatabaseName("role_name_index");
 27
 28        // Índice único composto: permite mesmo nome em orgs diferentes
 29        // AreNullsDistinct(false) gera NULLS NOT DISTINCT no PostgreSQL 15+
 430        entity.HasIndex(e => new { e.OwnerId, e.NormalizedName })
 431            .IsUnique()
 432            .AreNullsDistinct(false);
 433    }
 34}