< Summary

Information
Class: Api.Works.Models.WorkIdentifier
Assembly: Api
File(s): /home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Works/Models/Work.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
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/Work.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("works")]
 16public class Work : 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
 25    [MapperIgnore]
 26    public Guid OwnerId { get; set; }
 27
 28    public required string Title { get; set; }
 29
 30    public string? Description { get; set; }
 31
 32    public NodaTime.ZonedDateTime? WorkPublishedAt { get; set; }
 33    public NodaTime.ZonedDateTime? WorkUpdatedAt { get; set; }
 34    public List<WorkIdentifier> WorkIdentifiers { get; set; } = [];
 35
 36    // Navigation Properties
 37    public List<WorkTag> WorkTags { get; set; } = [];
 38    public List<Author> Authors { get; set; } = [];
 39
 40    [MapperIgnore]
 41    public List<WorkTag_Work> WorkTag_Works { get; set; } = [];
 42    [MapperIgnore]
 43    public List<Work_Author> Work_Authors { get; set; } = [];
 44}
 45
 046public record WorkIdentifier(
 047        string WorkIdentifierType,
 048        string WorkIdentifierValue);
 49
 50public class WorkTypeConfiguration : IEntityTypeConfiguration<Work>
 51{
 52    public void Configure(EntityTypeBuilder<Work> builder)
 53    {
 54        builder
 55            .ComplexCollection(w => w.WorkIdentifiers, wid => wid.ToJson())
 56            .HasIndex(w => w.WorkIdentifiers.Select(wid => wid));
 57    }
 58}

Methods/Properties

.ctor(string, string)