• 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/UriGeneratorService.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.Extensions.Options;
6
using Viae.Domain.Models;
7

8
namespace Viae.Persistence;
9

10
/// <summary>
11
/// Default implementation of IUriGeneratorService that generates URIs based on entity type and ID.
12
/// </summary>
13
/// <remarks>
14
/// Initializes a new instance of the <see cref="UriGeneratorService"/> class.
15
/// </remarks>
16
/// <param name="options">Configuration options containing the base URI.</param>
NEW
17
public class UriGeneratorService(IOptions<UriGeneratorOptions> options) : IUriGeneratorService
×
18
{
NEW
19
    private readonly UriGeneratorOptions _options = options.Value;
×
20

21
    /// <inheritdoc />
NEW
22
    public Uri BaseUri => _options.BaseUri;
×
23

24
    /// <inheritdoc />
25
    public Uri GenerateUri(Admissio entity)
26
    {
NEW
27
        return string.IsNullOrEmpty(entity.Id)
×
NEW
28
            ? throw new InvalidOperationException(
×
NEW
29
                "Cannot generate URI for Admissio: Id has not been assigned yet."
×
NEW
30
            )
×
NEW
31
            : new Uri($"{BaseUri.AbsoluteUri.TrimEnd('/')}/ping/{entity.Id}");
×
32
    }
33

34
    /// <inheritdoc />
35
    public Uri GenerateUri(Adreflexio entity)
36
    {
NEW
37
        return string.IsNullOrEmpty(entity.Id)
×
NEW
38
            ? throw new InvalidOperationException(
×
NEW
39
                "Cannot generate URI for Adreflexio: Id has not been assigned yet."
×
NEW
40
            )
×
NEW
41
            : new Uri($"{BaseUri.AbsoluteUri.TrimEnd('/')}/pong/{entity.Id}");
×
42
    }
43
}
44

45
/// <summary>
46
/// Configuration options for the URI generator service.
47
/// </summary>
48
public class UriGeneratorOptions
49
{
50
    /// <summary>
51
    /// Gets or sets the base URI for generating entity URIs.
52
    /// Example: "https://example.com"
53
    /// </summary>
54
    public Uri BaseUri { get; set; } = new Uri("https://localhost");
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