fix(seed): IgnoreQueryFilters on all seeder queries + sitemap invalid date guard
CI/CD / CI · API (dotnet build + test) (push) Successful in 45s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 31s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m13s
CI/CD / CI · Admin Web (tsc) (push) Successful in 40s
CI/CD / CI · Website (tsc) (push) Successful in 47s
CI/CD / CI · Koja (tsc) (push) Successful in 59s
CI/CD / Deploy · all services (push) Successful in 3m45s
CI/CD / CI · API (dotnet build + test) (push) Successful in 45s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 31s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m13s
CI/CD / CI · Admin Web (tsc) (push) Successful in 40s
CI/CD / CI · Website (tsc) (push) Successful in 47s
CI/CD / CI · Koja (tsc) (push) Successful in 59s
CI/CD / Deploy · all services (push) Successful in 3m45s
DemoSeedService / DemoMenuSeeder:
Add IgnoreQueryFilters() to every seeder lookup (Taxes, MenuCategories,
MenuItems). Soft-deleted rows still hold their PKs; without this a second
seed run after user-deletion throws a PK collision on the Tax or category
that was soft-deleted but is still in the index.
sitemap.ts:
Guard new Date(post.date) against empty / missing frontmatter date fields.
new Date("") = Invalid Date → broken <lastmod> in sitemap XML.
Fall back to the build-time date when the post date is absent or invalid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,9 @@ public class DemoSeedService : IDemoSeedService
|
||||
// 1. Ensure 9% default tax
|
||||
var taxId = $"{cafeId}_demo_tax";
|
||||
var taxCreated = false;
|
||||
if (!await _db.Taxes.AnyAsync(t => t.CafeId == cafeId && t.IsDefault, ct))
|
||||
// IgnoreQueryFilters: soft-deleted rows still occupy the PK; re-seeding
|
||||
// after a user deletes demo data must see those rows to avoid a PK collision.
|
||||
if (!await _db.Taxes.IgnoreQueryFilters().AnyAsync(t => t.CafeId == cafeId && t.IsDefault, ct))
|
||||
{
|
||||
_db.Taxes.Add(new Tax
|
||||
{
|
||||
@@ -51,6 +53,7 @@ public class DemoSeedService : IDemoSeedService
|
||||
else
|
||||
{
|
||||
taxId = await _db.Taxes
|
||||
.IgnoreQueryFilters()
|
||||
.Where(t => t.CafeId == cafeId && t.IsDefault)
|
||||
.Select(t => t.Id)
|
||||
.FirstAsync(ct);
|
||||
|
||||
@@ -23,7 +23,7 @@ public static class DemoMenuSeeder
|
||||
string Scoped(string catalogId) =>
|
||||
useScopedIds ? $"{cafeId}_{catalogId}" : catalogId;
|
||||
|
||||
if (!await db.Taxes.AnyAsync(t => t.Id == taxId && t.CafeId == cafeId))
|
||||
if (!await db.Taxes.IgnoreQueryFilters().AnyAsync(t => t.Id == taxId && t.CafeId == cafeId))
|
||||
{
|
||||
db.Taxes.Add(new Tax
|
||||
{
|
||||
@@ -38,6 +38,7 @@ public static class DemoMenuSeeder
|
||||
}
|
||||
|
||||
var existingCategoryIds = await db.MenuCategories
|
||||
.IgnoreQueryFilters()
|
||||
.Where(c => c.CafeId == cafeId)
|
||||
.ToDictionaryAsync(c => c.Id, StringComparer.Ordinal);
|
||||
|
||||
@@ -78,6 +79,7 @@ public static class DemoMenuSeeder
|
||||
}
|
||||
|
||||
var existingItemIds = await db.MenuItems
|
||||
.IgnoreQueryFilters()
|
||||
.Where(i => i.CafeId == cafeId)
|
||||
.Select(i => i.Id)
|
||||
.ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user