Extract season overview/workflow cards and add sponsor seed data
Splits AdminSeasonsView into AdminSeasonOverviewCard and AdminSeasonWorkflowCard for cleaner separation of concerns. Adds SeedSponsorsBootstrapper with demo sponsor SVG assets and extends SeedCatalog with sponsor seed entries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Backend.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Backend.Data;
|
||||
|
||||
public static partial class SeedDataBootstrapper
|
||||
{
|
||||
private static async Task EnsureSponsorsAsync(AwardsDbContext db, Season season)
|
||||
{
|
||||
var existingSponsors = await db.Sponsors
|
||||
.Where(item => item.SeasonId == season.Id)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var seed in SeedCatalog.DemoSponsorSeeds)
|
||||
{
|
||||
var sponsor = existingSponsors.FirstOrDefault(item =>
|
||||
string.Equals(item.Name, seed.Name, StringComparison.OrdinalIgnoreCase))
|
||||
?? new Sponsor
|
||||
{
|
||||
SeasonId = season.Id,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
sponsor.Name = seed.Name;
|
||||
sponsor.WebsiteUrl = seed.WebsiteUrl;
|
||||
sponsor.LogoUrl = seed.LogoUrl;
|
||||
sponsor.Description = seed.Description;
|
||||
sponsor.Tier = seed.Tier;
|
||||
sponsor.SortOrder = seed.SortOrder;
|
||||
sponsor.IsVisible = true;
|
||||
sponsor.UpdatedAt = DateTimeOffset.UtcNow;
|
||||
|
||||
if (sponsor.Id == 0)
|
||||
{
|
||||
db.Sponsors.Add(sponsor);
|
||||
existingSponsors.Add(sponsor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user