Voeg leesbare slug toe aan Offering naast het GUID-ID
Continuous Integration / config (pull_request) Successful in 12s
Continuous Integration / changes (pull_request) Successful in 21s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / backend-build (pull_request) Successful in 4m31s
Continuous Integration / vulnerability-scan (pull_request) Successful in 3m57s
Continuous Integration / backend-test (pull_request) Successful in 6m11s
Continuous Integration / publish-production (pull_request) Skipped
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / publish-test (pull_request) Successful in 5m51s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / config (pull_request) Successful in 12s
Continuous Integration / changes (pull_request) Successful in 21s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / backend-build (pull_request) Successful in 4m31s
Continuous Integration / vulnerability-scan (pull_request) Successful in 3m57s
Continuous Integration / backend-test (pull_request) Successful in 6m11s
Continuous Integration / publish-production (pull_request) Skipped
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / publish-test (pull_request) Successful in 5m51s
Continuous Integration / deploy-test (pull_request) Skipped
Het Offering-ID is een GUID en niet geschikt om aan gebruikers te tonen. Voeg een op de titel gebaseerde, unieke slug toe die via de public en admin API wordt meegegeven, zodat de frontend iets leesbaars kan tonen in plaats van het ruwe ID. Het ID blijft ongewijzigd de echte identifier. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,37 @@ public class OfferingRepositoryTests : IDisposable
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExistsBySlugAsync_ReturnsTrue_WhenSlugTaken()
|
||||
{
|
||||
await _sut.AddAsync(Offering("Website", displayOrder: 0));
|
||||
await _sut.SaveChangesAsync();
|
||||
|
||||
var result = await _sut.ExistsBySlugAsync("website");
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExistsBySlugAsync_ReturnsFalse_WhenSlugFree()
|
||||
{
|
||||
var result = await _sut.ExistsBySlugAsync("unused-slug");
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExistsBySlugAsync_ExcludesGivenId()
|
||||
{
|
||||
var offering = Offering("Website", displayOrder: 0);
|
||||
await _sut.AddAsync(offering);
|
||||
await _sut.SaveChangesAsync();
|
||||
|
||||
var result = await _sut.ExistsBySlugAsync("website", excludeId: offering.Id);
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Update_PersistsChanges()
|
||||
{
|
||||
@@ -170,6 +201,7 @@ public class OfferingRepositoryTests : IDisposable
|
||||
private static Offering Offering(string title, int displayOrder) => new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Slug = title.ToLowerInvariant(),
|
||||
Title = title,
|
||||
Description = "Description",
|
||||
Price = "€ 100",
|
||||
|
||||
Reference in New Issue
Block a user