• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Genfic / Ogma / 35489321541

20 Sep 2026 04:30AM UTC coverage: 0.573% (-0.01%) from 0.586%
35489321541

Pull #161

github

web-flow
Merge d0f8e0a5f into c4d98bb8a
Pull Request #161: Feature/soft delete queue

0 of 3162 new or added lines in 28 files covered. (0.0%)

584 existing lines in 7 files now uncovered.

880 of 153500 relevant lines covered (0.57%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Ogma3.Data/Blogposts/BlogpostConfiguration.cs
1
using Microsoft.EntityFrameworkCore;
2
using Microsoft.EntityFrameworkCore.Metadata.Builders;
3
using Ogma3.Data.Bases;
4
using Ogma3.Data.CommentsThreads;
5
using Ogma3.Data.Constants;
6
using Ogma3.Data.Helpers;
7

8
namespace Ogma3.Data.Blogposts;
9

10
public sealed class BlogpostConfiguration : BaseConfiguration<Blogpost>
11
{
12
        protected override void Config(EntityTypeBuilder<Blogpost> builder)
13
        {
NEW
14
                builder.HasQueryFilter(b => b.ScheduledForDeletion == null);
×
15

16
                // CONSTRAINTS
17
                builder
×
18
                        .Property(b => b.Title)
×
19
                        .IsRequired()
×
20
                        .UseCollation(PgConstants.CollationNames.CaseInsensitive)
×
21
                        .HasMaxLength(CTConfig.Blogpost.MaxTitleLength);
×
22

23
                builder.HasIndex(b => b.Title);
×
24
                builder.HasIndex(b => b.PublicationDate);
×
NEW
25
                builder.HasPartialIndex(b => b.ScheduledForDeletion);
×
26

27
                builder
×
28
                        .HasIndex(b => b.Hashtags)
×
29
                        .HasMethod(PgConstants.IndexTypes.Gin)
×
30
                        .HasFilter($"\"{nameof(Blogpost.IsVisible)}\"");
×
31

32
                builder
×
33
                        .Property(b => b.Slug)
×
34
                        .IsRequired()
×
35
                        .HasMaxLength(CTConfig.Blogpost.MaxTitleLength);
×
36

37
                builder
×
38
                        .Property(b => b.ExcerptCutoff)
×
39
                        .IsRequired()
×
40
                        .HasDefaultValue(200);
×
41

42
                builder
×
43
                        .Property(b => b.CreationDate)
×
44
                        .IsRequired()
×
45
                        .HasDefaultValueSql(PgConstants.CurrentTimestamp);
×
46

47
                builder
×
48
                        .Property(b => b.PublicationDate)
×
49
                        .HasDefaultValue(null);
×
50

51
                builder
×
52
                        .Property(b => b.IsVisible)
×
53
                        .HasDefaultValue(false);
×
54

55
                builder
×
56
                        .Property(b => b.Body)
×
57
                        .IsRequired()
×
58
                        .HasMaxLength(CTConfig.Blogpost.MaxBodyLength);
×
59

60
                builder
×
61
                        .Property(b => b.WordCount)
×
62
                        .HasDefaultValue(0);
×
63

64
                builder
×
65
                        .PrimitiveCollection(b => b.Hashtags)
×
66
                        .IsRequired()
×
67
                        .HasDefaultValue(Array.Empty<string>())
×
68
                        .ElementType(e => e.HasMaxLength(CTConfig.Blogpost.MaxTagLength));
×
69
                builder
×
70
                        .HasMaxCardinality(b => b.Hashtags, CTConfig.Blogpost.MaxTagsAmount);
×
71

72

73
                // NAVIGATION
74
                builder
×
75
                        .HasOne(b => b.Author)
×
76
                        .WithMany(u => u.Blogposts)
×
77
                        .HasForeignKey(b => b.AuthorId)
×
78
                        .OnDelete(DeleteBehavior.SetDefault);
×
79
                builder
×
80
                        .Property(b => b.AuthorId)
×
81
                        .HasDefaultValue(SystemUserConstants.Deleted.Id);
×
82

83
                builder
×
84
                        .HasOne(b => b.CommentThread)
×
85
                        .WithOne(ct => ct.Blogpost)
×
86
                        .HasForeignKey<CommentThread>(ct => ct.BlogpostId)
×
87
                        .OnDelete(DeleteBehavior.Cascade);
×
88

89
                builder
×
90
                        .HasOne(b => b.AttachedStory)
×
91
                        .WithMany()
×
92
                        .HasForeignKey(b => b.AttachedStoryId)
×
93
                        .OnDelete(DeleteBehavior.SetNull);
×
94

95
                builder
×
96
                        .HasOne(b => b.AttachedChapter)
×
97
                        .WithMany()
×
98
                        .HasForeignKey(b => b.AttachedChapterId)
×
99
                        .OnDelete(DeleteBehavior.SetNull);
×
100

101
                builder
×
102
                        .HasOne(b => b.ContentBlock)
×
103
                        .WithOne()
×
104
                        .HasForeignKey<Blogpost>(b => b.ContentBlockId);
×
105

106
                builder
×
107
                        .HasMany(b => b.Reports)
×
108
                        .WithOne(r => r.Blogpost)
×
109
                        .HasForeignKey(r => r.BlogpostId)
×
110
                        .OnDelete(DeleteBehavior.Cascade);
×
111
        }
×
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc