< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Data.EntityMaps.ApplicationDbMap
Assembly: ArturRios.Heimdall.Data
File(s): /home/ci/agent/workspace/heimdall-api-docs_main/app/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/ci/agent/workspace/heimdall-api-docs_main/app/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    {
 411        application.ToTable("application");
 12
 413        application.HasKey(x => x.Id);
 14
 415        application.Property(x => x.PublicId).IsRequired();
 416        application.HasIndex(x => x.PublicId).IsUnique();
 17
 418        application.Property(x => x.Name).IsRequired();
 19
 420        application.Property(x => x.IsDeleted).HasDefaultValue(false);
 21
 422        application.Property(x => x.CreatedAt).HasDefaultValueSql("now()");
 423        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).
 427        application.HasOne(x => x.Scope)
 428            .WithMany(s => s.Applications)
 429            .HasForeignKey(x => x.ScopeId)
 430            .IsRequired()
 431            .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).
 435        application.HasOne(x => x.Owner)
 436            .WithMany(p => p.OwnedApplications)
 437            .HasForeignKey(x => x.OwnerId)
 438            .IsRequired()
 439            .OnDelete(DeleteBehavior.Cascade);
 440    }
 41}