< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ApplicationDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Infrastructure/ArturRios.Heimdall.Data/EntityMaps/ApplicationDbMap.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 41
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/ApplicationDbMap.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 ApplicationDbMap
 8{
 9    public static void Configure(this EntityTypeBuilder<Application> application)
 10    {
 311        application.ToTable("application");
 12
 313        application.HasKey(x => x.Id);
 14
 315        application.Property(x => x.PublicId).IsRequired();
 316        application.HasIndex(x => x.PublicId).IsUnique();
 17
 318        application.Property(x => x.Name).IsRequired();
 19
 320        application.Property(x => x.IsDeleted).HasDefaultValue(false);
 21
 322        application.Property(x => x.CreatedAt).HasDefaultValueSql("now()");
 323        application.Property(x => x.UpdatedAt).HasDefaultValueSql("now()");
 24
 25        // Every application belongs to exactly one scope (FR-AP-02); hard-deleting the scope
 26        // cascades to its applications (NFR-08).
 327        application.HasOne(x => x.Scope)
 328            .WithMany(s => s.Applications)
 329            .HasForeignKey(x => x.ScopeId)
 330            .IsRequired()
 331            .OnDelete(DeleteBehavior.Cascade);
 32
 33        // Every application has exactly one owning person (FR-AP-03); hard-deleting the owner
 34        // cascades to the applications they own (NFR-11).
 335        application.HasOne(x => x.Owner)
 336            .WithMany(p => p.OwnedApplications)
 337            .HasForeignKey(x => x.OwnerId)
 338            .IsRequired()
 339            .OnDelete(DeleteBehavior.Cascade);
 340    }
 41}