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

curt / Viae / 19527137380

20 Nov 2025 05:53AM UTC coverage: 51.56%. First build
19527137380

push

github

web-flow
feat: provide minimal locus and vestigium views (#1)

62 of 109 branches covered (56.88%)

Branch coverage included in aggregate %.

500 of 981 new or added lines in 61 files covered. (50.97%)

500 of 981 relevant lines covered (50.97%)

19.89 hits per line

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

0.0
/endpoint/src/Viae.Persistence/ModelBuilderExtensions.cs
1
// Copyright © 2025 Curt Gilman
2
// SPDX-License-Identifier: AGPL-3.0-only
3
// Viae: A geo-centric, journey-focused, federated blog platform
4

5
using Microsoft.EntityFrameworkCore;
6
using Viae.Domain.Models;
7
using Viae.Persistence.Generators;
8

9
namespace Viae.Persistence;
10

11
public static class ModelBuilderExtensions
12
{
13
    /// <summary>
14
    /// For every entity that implements IIdentifiable, configures:
15
    ///   - Id column type: base58id
16
    ///   - Client-side value generation via Base58IdValueGenerator
17
    ///   - Required
18
    /// </summary>
19
    public static ModelBuilder ApplyIdentifiableConvention(this ModelBuilder modelBuilder)
20
    {
21
        foreach (
NEW
22
            var et in modelBuilder
×
NEW
23
                .Model.GetEntityTypes()
×
NEW
24
                .Where(et => typeof(IIdentifiable).IsAssignableFrom(et.ClrType) && !et.IsOwned())
×
25
        )
26
        {
27
            // Must be the interface member name, and we expect string
NEW
28
            var idProp = et.FindProperty(nameof(IIdentifiable.Id));
×
NEW
29
            if (idProp is null || idProp.ClrType != typeof(string))
×
30
            {
31
                continue;
32
            }
33

NEW
34
            modelBuilder
×
NEW
35
                .Entity(et.ClrType)
×
NEW
36
                .Property(nameof(IIdentifiable.Id))
×
NEW
37
                .HasColumnType("char(11)")
×
NEW
38
                .HasValueGenerator<Base58IdValueGenerator>();
×
39
        }
40

NEW
41
        return modelBuilder;
×
42
    }
43

44
    /// <summary>
45
    /// For every entity that implements IUriIdentifiable, configures the Uri property.
46
    /// The actual URI generation is handled by the UriGenerationInterceptor.
47
    /// This should be called after ApplyIdentifiableConvention.
48
    /// </summary>
49
    public static ModelBuilder ApplyUriIdentifiableConvention(this ModelBuilder modelBuilder)
50
    {
51
        // No special configuration needed - the UriGenerationInterceptor handles everything
52
        // This method exists for consistency and potential future configuration needs
NEW
53
        return modelBuilder;
×
54
    }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc