6b3b0360e7
Deliver the demo-ready feature set and seed data so the live site can be presented end to end: - Winner archive: ArchivedWinner domain, admin CRUD endpoints/view/manager and public archive surface, backed by AddArchivedWinners migration. - Host presentation: host image upload and artist name on SiteSettings with public image endpoint and supporting migrations. - Clip submissions: idempotent table-ensure migration plus current-season demo clips for review workflows. - Demo seed data: sponsors, share links and 2025 archived winners, with a guarded RemoveDemoSeasons cleanup; all seeds guard against real data. - EnsureRuntimeSchemaParity migration to align runtime schema defensively. - Admin/home UI refinements; remove unused team role permissions modal and dead share-quick-links code. All seed and schema migrations are idempotent (IF NOT EXISTS / ON CONFLICT) and skip when real season data is present. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Backend.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Backend.Endpoints;
|
|
|
|
public static partial class PublicEndpoints
|
|
{
|
|
private static async Task<IResult> GetHostImage(AwardsDbContext db)
|
|
{
|
|
var settings = await db.SiteSettings
|
|
.AsNoTracking()
|
|
.Where(item => item.Id == 1)
|
|
.Select(item => new
|
|
{
|
|
item.HostImageData,
|
|
item.HostImageContentType,
|
|
item.HostImageUpdatedAt,
|
|
})
|
|
.FirstOrDefaultAsync();
|
|
|
|
if (settings?.HostImageData is not { Length: > 0 } imageData
|
|
|| string.IsNullOrWhiteSpace(settings.HostImageContentType))
|
|
{
|
|
return Results.NotFound();
|
|
}
|
|
|
|
var entityTag = settings.HostImageUpdatedAt?.ToUnixTimeSeconds().ToString(System.Globalization.CultureInfo.InvariantCulture)
|
|
?? imageData.Length.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
|
return Results.File(
|
|
imageData,
|
|
settings.HostImageContentType,
|
|
entityTag: new Microsoft.Net.Http.Headers.EntityTagHeaderValue($"\"host-{entityTag}\""),
|
|
lastModified: settings.HostImageUpdatedAt);
|
|
}
|
|
}
|