list_task_lists returns two different ID formats: dashed UUIDs (e.g. "caed660e-109f-4e2a-b055-2c2722bf6fb7") and compact 32-char hex (e.g. "5c2cafcb33f044069ac324ac3fd84a16"). Mixing formats makes equality checks, logging, and lookups error-prone. Fix: pick one canonical format (recommend dashed UUID) and normalize on write + migrate existing records. Ensure all ID-returning tools emit the same f ClaudeDo-Task: fa8b69e0-6f8d-41d7-9a41-88db1360544d
26 lines
761 B
C#
26 lines
761 B
C#
using ClaudeDo.Data.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ClaudeDo.Data.Seeding;
|
|
|
|
public static class DefaultListsSeeder
|
|
{
|
|
private static readonly string[] Defaults = { "My Day", "Important", "Planned" };
|
|
|
|
public static async Task SeedAsync(ClaudeDoDbContext ctx, CancellationToken ct = default)
|
|
{
|
|
var existing = await ctx.Lists.Select(l => l.Name).ToListAsync(ct);
|
|
var now = DateTime.UtcNow;
|
|
foreach (var name in Defaults.Where(n => !existing.Contains(n)))
|
|
{
|
|
ctx.Lists.Add(new ListEntity
|
|
{
|
|
Id = Guid.NewGuid().ToString(),
|
|
Name = name,
|
|
CreatedAt = now,
|
|
});
|
|
}
|
|
await ctx.SaveChangesAsync(ct);
|
|
}
|
|
}
|