< Summary

Information
Class: Api.Works.Models.Author
Assembly: Api
File(s): /home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Works/Models/Author.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 58
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%

File(s)

/home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Works/Models/Author.cs

#LineLine coverage
 1// SPDX-FileCopyrightText: 2026 Alper Çelik <[email protected]>
 2//
 3// SPDX-License-Identifier: AGPL-3.0-or-later
 4
 5using System.ComponentModel.DataAnnotations;
 6using System.ComponentModel.DataAnnotations.Schema;
 7
 8using Microsoft.EntityFrameworkCore;
 9using Microsoft.EntityFrameworkCore.Metadata.Builders;
 10
 11using Riok.Mapperly.Abstractions;
 12
 13namespace Api.Works.Models;
 14
 15[Table("authors")]
 16public class Author : IEntityMetadata
 17{
 18    [Key]
 19    public Guid Id { get; set; }
 20    public int RowVersion { get; set; }
 21    public NodaTime.Instant MetadataAddedAt { get; set; }
 22    public NodaTime.Instant MetadataUpdatedAt { get; set; }
 23
 24    public string? FirstName { get; set; }
 25
 26    public string? LastName { get; set; }
 27
 28    public required string DisplayName { get; set; }
 29
 30    public required List<string> PenNames { get; set; }
 31
 32    // Navigation Properties
 33    [MapperIgnore]
 034    public List<Work> Works { get; set; } = [];
 35}
 36
 37[Table("work___author")]
 38[PrimaryKey(nameof(WorkId), nameof(AuthorId))]
 39public class Work_Author
 40{
 41    public Guid WorkId { get; set; }
 42    public Guid AuthorId { get; set; }
 43
 44    // Navigation Properties
 45    public Work Work { get; set; } = null!;
 46    public Author Author { get; set; } = null!;
 47}
 48
 49public class AuthorTypeConfiguration : IEntityTypeConfiguration<Author>
 50{
 51    public void Configure(EntityTypeBuilder<Author> builder)
 52    {
 53        builder
 54            .HasMany(a => a.Works)
 55            .WithMany(w => w.Authors)
 56            .UsingEntity(typeof(Work_Author));
 57    }
 58}

Methods/Properties

.ctor()