< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.TwoFactorRecoveryCodeDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/TwoFactorRecoveryCodeDbMap.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 31
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/TwoFactorRecoveryCodeDbMap.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 TwoFactorRecoveryCodeDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<TwoFactorRecoveryCode> recoveryCode)
 10    {
 311        recoveryCode.ToTable("two_factor_recovery_code");
 12
 13        // Internal bigint Id only; never addressed by ID — reached through the owning
 14        // TwoFactorAuth configuration.
 315        recoveryCode.HasKey(x => x.Id);
 16
 317        recoveryCode.Property(x => x.CodeHash).IsRequired();
 18
 319        recoveryCode.Property(x => x.Used).HasDefaultValue(false);
 320        recoveryCode.Property(x => x.UsedAt);
 21
 322        recoveryCode.Property(x => x.CreatedAt).HasDefaultValueSql("now()");
 23
 24        // Codes are removed when their two-factor configuration is removed.
 325        recoveryCode.HasOne(x => x.TwoFactorAuth)
 326            .WithMany(t => t.RecoveryCodes)
 327            .HasForeignKey(x => x.TwoFactorAuthId)
 328            .IsRequired()
 329            .OnDelete(DeleteBehavior.Cascade);
 330    }
 31}