< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ScopeUserDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/ScopeUserDbMap.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 30
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/ScopeUserDbMap.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 ScopeUserDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<ScopeUser> scopeUser)
 10    {
 311        scopeUser.ToTable("scope_user");
 12
 13        // Composite key (ScopeId, PersonId); no surrogate Id and no PublicId (§4.6).
 314        scopeUser.HasKey(x => new { x.ScopeId, x.PersonId });
 15
 16        // A scope's users are removed when the scope is hard-deleted (NFR-08).
 317        scopeUser.HasOne(x => x.Scope)
 318            .WithMany(s => s.Users)
 319            .HasForeignKey(x => x.ScopeId)
 320            .OnDelete(DeleteBehavior.Cascade);
 21
 22        // One-to-one with Person: a User belongs to exactly one scope, so PersonId is unique across
 23        // this table (§4.6). The single-navigation reciprocal is Person.ScopeMembership. The
 24        // membership row is removed when the person is hard-deleted (UC-10).
 325        scopeUser.HasOne(x => x.Person)
 326            .WithOne(p => p.ScopeMembership)
 327            .HasForeignKey<ScopeUser>(x => x.PersonId)
 328            .OnDelete(DeleteBehavior.Cascade);
 329    }
 30}