< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ApplicationCredentialDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/ApplicationCredentialDbMap.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 33
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/ApplicationCredentialDbMap.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 ApplicationCredentialDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<ApplicationCredential> credential)
 10    {
 311        credential.ToTable("application_credential");
 12
 313        credential.HasKey(x => x.Id);
 14
 315        credential.Property(x => x.PublicId).IsRequired();
 316        credential.HasIndex(x => x.PublicId).IsUnique();
 17
 18        // UC-56 looks a credential up by the hash of the presented secret, so the hash is indexed;
 19        // unique because two credentials sharing one would make that lookup ambiguous.
 320        credential.Property(x => x.SecretHash).IsRequired();
 321        credential.HasIndex(x => x.SecretHash).IsUnique();
 22
 323        credential.Property(x => x.CreatedAt).IsRequired();
 24
 25        // Credentials go with their application when it is hard-deleted (UC-20); a logical delete
 26        // leaves them, and UC-56/UC-57 refuse them through the application's flag.
 327        credential.HasOne(x => x.Application)
 328            .WithMany(a => a.Credentials)
 329            .HasForeignKey(x => x.ApplicationId)
 330            .IsRequired()
 331            .OnDelete(DeleteBehavior.Cascade);
 332    }
 33}