< Summary

Information
Class: Api.Works.Models.Work
Assembly: Api
File(s): /home/runner/work/ProjectRead.ing/ProjectRead.ing/Api/Works/Models/Work.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 63
Line coverage: 100%
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
get_IdPostfix()100%11100%
.ctor()100%11100%

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;
 7using Api.Auth.Models;
 8using Microsoft.EntityFrameworkCore;
 9using Microsoft.EntityFrameworkCore.Metadata.Builders;
 10using Riok.Mapperly.Abstractions;
 11
 12namespace Api.Works.Models;
 13
 14[Table("works")]
 15[Index(nameof(WorkIdentifiers))]
 16public class Work : IDbEntityMetadata
 17{
 118    public static byte IdPostfix => (byte)IdPostfixes.Work;
 19
 20    [Key]
 21    public Guid Id { get; set; }
 22    public int RowVersion { get; set; }
 23    public NodaTime.Instant MetadataAddedAt { get; set; }
 24    public NodaTime.Instant MetadataUpdatedAt { get; set; }
 25
 26    [MapperIgnore]
 27    [ForeignKey(nameof(Owner))]
 28    public Guid OwnerId { get; set; }
 29
 30    public required string Title { get; set; }
 31
 32    public string? Description { get; set; }
 33
 34    public NodaTime.ZonedDateTime? WorkPublishedAt { get; set; }
 35    public NodaTime.ZonedDateTime? WorkUpdatedAt { get; set; }
 136    public List<WorkIdentifier> WorkIdentifiers { get; set; } = [];
 37
 38    // Navigation Properties
 39    [MapperIgnore]
 140    public List<WorkTag> WorkTags { get; set; } = [];
 41
 42    [MapperIgnore]
 143    public List<Author> Authors { get; set; } = [];
 44
 45    [MapperIgnore]
 146    public List<WorkTag_Work> WorkTag_Works { get; set; } = [];
 47
 48    [MapperIgnore]
 149    public List<Work_Author> Work_Authors { get; set; } = [];
 50
 51    [MapperIgnore]
 152    public UserEF Owner { get; set; } = null!;
 53}
 54
 55public record WorkIdentifier(string WorkIdentifierType, string WorkIdentifierValue);
 56
 57public class WorkTypeConfiguration : IEntityTypeConfiguration<Work>
 58{
 59    public void Configure(EntityTypeBuilder<Work> builder)
 60    {
 61        builder.ComplexCollection(w => w.WorkIdentifiers, wid => wid.ToJson());
 62    }
 63}

Methods/Properties

get_IdPostfix()
.ctor()