< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ScopeOwnerDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/ScopeOwnerDbMap.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 28
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/ScopeOwnerDbMap.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 ScopeOwnerDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<ScopeOwner> scopeOwner)
 10    {
 311        scopeOwner.ToTable("scope_owner");
 12
 13        // Composite key (ScopeId, PersonId); no surrogate Id and no PublicId (§4.5).
 314        scopeOwner.HasKey(x => new { x.ScopeId, x.PersonId });
 15
 16        // A scope's owners are removed when the scope is hard-deleted (NFR-08).
 317        scopeOwner.HasOne(x => x.Scope)
 318            .WithMany(s => s.Owners)
 319            .HasForeignKey(x => x.ScopeId)
 320            .OnDelete(DeleteBehavior.Cascade);
 21
 22        // A ScopeAdmin's ownership rows are removed when the person is hard-deleted (UC-10).
 323        scopeOwner.HasOne(x => x.Person)
 324            .WithMany(p => p.ScopeOwnerships)
 325            .HasForeignKey(x => x.PersonId)
 326            .OnDelete(DeleteBehavior.Cascade);
 327    }
 28}