< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ApplicationCredentialDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/ci/agent/workspace/heimdall-api-docs_main/app/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/ci/agent/workspace/heimdall-api-docs_main/app/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    {
 411        credential.ToTable("application_credential");
 12
 413        credential.HasKey(x => x.Id);
 14
 415        credential.Property(x => x.PublicId).IsRequired();
 416        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.
 420        credential.Property(x => x.SecretHash).IsRequired();
 421        credential.HasIndex(x => x.SecretHash).IsUnique();
 22
 423        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.
 427        credential.HasOne(x => x.Application)
 428            .WithMany(a => a.Credentials)
 429            .HasForeignKey(x => x.ApplicationId)
 430            .IsRequired()
 431            .OnDelete(DeleteBehavior.Cascade);
 432    }
 33}