Skip to content

Commit

Permalink
fix: TodoBackend - filtering was missing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Oct 7, 2024
1 parent ac39578 commit 556004f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
20 changes: 3 additions & 17 deletions src/TodoApp/AspireHost/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
3 changes: 2 additions & 1 deletion src/TodoApp/Services/Db/DbTodo.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
2 changes: 2 additions & 0 deletions src/TodoApp/Services/TodoBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ public virtual async Task<Ulid[]> 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)
Expand Down

0 comments on commit 556004f

Please sign in to comment.