From 556004f5d6866c7f7f08bbb4dc4f53a68cec1c46 Mon Sep 17 00:00:00 2001 From: Alex Yakunin Date: Mon, 7 Oct 2024 04:15:54 -0700 Subject: [PATCH] fix: TodoBackend - filtering was missing --- .../AspireHost/Properties/launchSettings.json | 20 +++---------------- src/TodoApp/Services/Db/DbTodo.cs | 3 ++- src/TodoApp/Services/TodoBackend.cs | 2 ++ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/TodoApp/AspireHost/Properties/launchSettings.json b/src/TodoApp/AspireHost/Properties/launchSettings.json index cab2d60..876deb6 100644 --- a/src/TodoApp/AspireHost/Properties/launchSettings.json +++ b/src/TodoApp/AspireHost/Properties/launchSettings.json @@ -1,30 +1,16 @@ { "$schema": "https://json.schemastore.org/launchsettings.json", "profiles": { - /* - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:17120;http://localhost:15185", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development", - "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21151", - "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22136" - } - }, - */ "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:15185", + "applicationUrl": "http://localhost:7000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19070", - "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20130", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:7100", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:7200", "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" // "DCP_IP_VERSION_PREFERENCE": "ipv4" } diff --git a/src/TodoApp/Services/Db/DbTodo.cs b/src/TodoApp/Services/Db/DbTodo.cs index 59c95c9..fc02ac3 100644 --- a/src/TodoApp/Services/Db/DbTodo.cs +++ b/src/TodoApp/Services/Db/DbTodo.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Globalization; using Samples.TodoApp.Abstractions; namespace Samples.TodoApp.Services.Db; @@ -37,7 +38,7 @@ public static (string Folder, Ulid Id) SplitKey(string key) throw new ArgumentOutOfRangeException(nameof(key)); var folder = key[..lastSlashIndex]; - var id = Ulid.Parse(key[(lastSlashIndex + 1)..]); + var id = Ulid.Parse(key[(lastSlashIndex + 1)..], CultureInfo.InvariantCulture); return (folder, id); } } diff --git a/src/TodoApp/Services/TodoBackend.cs b/src/TodoApp/Services/TodoBackend.cs index 8c52631..6342a1e 100644 --- a/src/TodoApp/Services/TodoBackend.cs +++ b/src/TodoApp/Services/TodoBackend.cs @@ -104,7 +104,9 @@ public virtual async Task ListIds(string folder, int limit, Cancellation var dbContext = await DbHub.CreateDbContext(tenant, cancellationToken).ConfigureAwait(false); await using var _ = dbContext.ConfigureAwait(false); + var prefix = $"{folder}/"; var keys = await dbContext.Todos + .Where(x => x.Key.StartsWith(prefix)) .OrderBy(x => x.Key) // We want 100% stable order here .Select(x => x.Key) .Take(limit)