< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.PendingRegistrationDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/PendingRegistrationDbMap.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 39
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

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

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/PendingRegistrationDbMap.cs

#LineLine coverage
 1using ArturRios.Heimdall.Domain.Entities;
 2using Microsoft.EntityFrameworkCore;
 3using Microsoft.EntityFrameworkCore.Metadata.Builders;
 4
 5namespace ArturRios.Heimdall.Data.EntityMaps;
 6
 7internal static class PendingRegistrationDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<PendingRegistration> pending)
 10    {
 311        pending.ToTable("pending_registration");
 12
 13        // Internal bigint Id as the key. The registrant's reference is the mailed token; an
 14        // administrator's is PublicId (UC-49, UC-50; §4.0).
 315        pending.HasKey(x => x.Id);
 16
 317        pending.Property(x => x.PublicId).IsRequired();
 318        pending.HasIndex(x => x.PublicId).IsUnique();
 19
 20        // Name is bounded at 200 by the entity's [MaxLength]. Both are caller-supplied text stored before
 21        // any person exists, so the column matches the request's bound (PersonFieldRules).
 322        pending.Property(x => x.Name).IsRequired();
 323        pending.Property(x => x.Email).IsRequired().HasMaxLength(256);
 324        pending.Property(x => x.PasswordHash).IsRequired();
 325        pending.Property(x => x.Salt).IsRequired();
 326        pending.Property(x => x.TokenHash).IsRequired();
 327        pending.HasIndex(x => x.TokenHash).IsUnique();
 328        pending.Property(x => x.ExpiresAt).IsRequired();
 329        pending.Property(x => x.CreatedAt).HasDefaultValueSql("now()");
 330        pending.Property(x => x.FailedAttempts).HasDefaultValue(0);
 31
 32        // A pending registration means nothing once its scope is gone (UC-05 hard delete).
 333        pending.HasOne(x => x.Scope)
 334            .WithMany()
 335            .HasForeignKey(x => x.ScopeId)
 336            .IsRequired()
 337            .OnDelete(DeleteBehavior.Cascade);
 338    }
 39}