H2: Hero-module (tabellen en migratie, beheer-API, publieke GET /hero, afbeeldingsupload met focus, opschoonservice, teksten) en OpenAPI-snapshot

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 15:46:55 +01:00
co-authored by Claude Sonnet 5.5
parent 43925cbf37
commit ae04120d8c
31 changed files with 4221 additions and 3 deletions
@@ -0,0 +1,76 @@
using System.ComponentModel.DataAnnotations;
using SlpModularCms.Core.Media;
using SlpModularCms.Core.Texts;
namespace SlpModularCms.Modules.Hero;
/// <summary>The keys of the Hero module texts (<c>Texts/nl.json</c>, <c>Texts/en.json</c>, key path <c>hero.*</c>).</summary>
public static class HeroTexts
{
public static class Validation
{
public static class Title
{
public static readonly TextKey Required = new("hero.validation.title.required");
public static readonly TextKey TooLong = new("hero.validation.title.tooLong", "max");
public static readonly TextKey TooManyLines = new("hero.validation.title.tooManyLines", "max");
}
public static readonly TextKey TaglineTooLong = new("hero.validation.tagline.tooLong", "max");
public static readonly TextKey LeadTooLong = new("hero.validation.lead.tooLong", "max");
public static readonly TextKey DisplayInvalid = new("hero.validation.display.invalid");
public static class Button
{
public static readonly TextKey Incomplete = new("hero.validation.button.incomplete");
public static readonly TextKey LabelTooLong = new("hero.validation.button.labelTooLong", "max");
public static readonly TextKey TargetTooLong = new("hero.validation.button.targetTooLong", "max");
public static readonly TextKey TargetInvalid = new("hero.validation.button.targetInvalid");
public static readonly TextKey TooMany = new("hero.validation.button.tooMany", "max");
}
public static readonly TextKey EndAfterStart = new("hero.validation.schedule.endAfterStart");
public static class Slide
{
public static readonly TextKey ImageRequired = new("hero.validation.slide.imageRequired");
public static readonly TextKey ImageUnknown = new("hero.validation.slide.imageUnknown");
public static readonly TextKey AltRequired = new("hero.validation.slide.altRequired");
public static readonly TextKey AltTooLong = new("hero.validation.slide.altTooLong", "max");
public static readonly TextKey IdUnknown = new("hero.validation.slide.idUnknown");
}
public static readonly TextKey FocusInvalid = new("hero.validation.focus.invalid", "maxZoom");
}
public static class Image
{
public static readonly TextKey InUse = new("hero.image.inUse");
public static readonly TextKey NotFound = new("hero.image.notFound");
public static readonly TextKey StorageFull = new("hero.image.storageFull");
public static readonly TextKey TooLarge = new("hero.image.rejected.tooLarge", "max");
public static readonly TextKey UnsupportedFormat = new("hero.image.rejected.unsupportedFormat");
public static readonly TextKey Corrupt = new("hero.image.rejected.corrupt");
public static readonly TextKey TooManyPixels = new("hero.image.rejected.tooManyPixels");
public static readonly TextKey Timeout = new("hero.image.rejected.timeout");
public static readonly TextKey Busy = new("hero.image.rejected.busy");
public static readonly TextKey Unavailable = new("hero.image.rejected.unavailable");
/// <summary>The text key for a rejection; the size limit is given in MB for the "too large" message.</summary>
public static TextKey For(ImageRejection reason) => reason switch
{
ImageRejection.TooLarge => TooLarge,
ImageRejection.UnsupportedFormat => UnsupportedFormat,
ImageRejection.Corrupt => Corrupt,
ImageRejection.TooManyPixels => TooManyPixels,
ImageRejection.Timeout => Timeout,
ImageRejection.Busy => Busy,
_ => Unavailable,
};
}
/// <summary>The catalogue of the request being validated, or the shared default one outside a request (unit tests).</summary>
public static ITextCatalog From(ValidationContext? context)
=> context?.GetService(typeof(ITextCatalog)) as ITextCatalog ?? TextCatalog.Default;
}