WEB-0: CMS content model + /api/site-snapshot + Page/Block CRUD
- Entities: Site (singleton, navOrder JSON), Page (slug/title/seoDescription/status enum),
Block (single table, Type enum + Data JSON; RichText=Markdown), Media. Migration
AddCmsEntities, seeds 6 Jimdo-mirror pages (placeholder Heading each; abgabetiere also an
auto AbgabetiereList block) + Site singleton nav.
- GET /api/site-snapshot: one JSON doc (site nav + pages + ordered blocks {id,order,type,data});
AbgabetiereList(auto) resolved from live ForSale gerbils -> {name, farbschlag, group(=Becken),
photos[urls], aiSaleText:null} (no price per god). SiteSnapshotService.
- CRUD: GET/POST/PUT/DELETE pages; add/update/delete blocks; PUT .../blocks/order reorder.
Block type allowlisted by enum; data validated as JSON object.
This commit is contained in:
@@ -21,6 +21,91 @@ namespace GerbilManagerWebAPI.Migrations
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Block", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("PageId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PageId");
|
||||
|
||||
b.ToTable("Blocks");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000001"),
|
||||
Data = "{\"text\":\"Startseite\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000001"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000002"),
|
||||
Data = "{\"text\":\"Über die Zucht\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000002"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000003"),
|
||||
Data = "{\"text\":\"Abgabetiere\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000003"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000004"),
|
||||
Data = "{\"text\":\"Abgabebedingungen\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000004"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000005"),
|
||||
Data = "{\"text\":\"Farben & Genetik\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000005"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000006"),
|
||||
Data = "{\"text\":\"Kontakt\",\"level\":1}",
|
||||
Order = 0,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000006"),
|
||||
Type = "Heading"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720002-0000-0000-0000-000000000010"),
|
||||
Data = "{\"mode\":\"auto\",\"intro\":\"\"}",
|
||||
Order = 1,
|
||||
PageId = new Guid("51720001-0000-0000-0000-000000000003"),
|
||||
Type = "AbgabetiereList"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.BreederSettings", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -842,6 +927,107 @@ namespace GerbilManagerWebAPI.Migrations
|
||||
b.ToTable("Litters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Media", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Alt")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Height")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Width")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Media");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Page", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("SeoDescription")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Pages");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000001"),
|
||||
Slug = "start",
|
||||
Status = "Published",
|
||||
Title = "Startseite"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000002"),
|
||||
Slug = "ueber-die-zucht",
|
||||
Status = "Published",
|
||||
Title = "Über die Zucht"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000003"),
|
||||
Slug = "abgabetiere",
|
||||
Status = "Published",
|
||||
Title = "Abgabetiere"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000004"),
|
||||
Slug = "abgabebedingungen",
|
||||
Status = "Published",
|
||||
Title = "Abgabebedingungen"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000005"),
|
||||
Slug = "farben-genetik",
|
||||
Status = "Published",
|
||||
Title = "Farben & Genetik"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("51720001-0000-0000-0000-000000000006"),
|
||||
Slug = "kontakt",
|
||||
Status = "Published",
|
||||
Title = "Kontakt"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.SaleContract", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -890,6 +1076,33 @@ namespace GerbilManagerWebAPI.Migrations
|
||||
b.ToTable("SaleContractAnimal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Site", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("DefaultLocale")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NavOrder")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Sites");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("5172e000-0000-0000-0000-000000000001"),
|
||||
DefaultLocale = "de",
|
||||
NavOrder = "[\"51720001-0000-0000-0000-000000000001\",\"51720001-0000-0000-0000-000000000002\",\"51720001-0000-0000-0000-000000000003\",\"51720001-0000-0000-0000-000000000004\",\"51720001-0000-0000-0000-000000000005\",\"51720001-0000-0000-0000-000000000006\"]"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.WeightRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -915,6 +1128,15 @@ namespace GerbilManagerWebAPI.Migrations
|
||||
b.ToTable("WeightRecords");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Block", b =>
|
||||
{
|
||||
b.HasOne("GerbilManagerWebAPI.Models.Page", null)
|
||||
.WithMany("Blocks")
|
||||
.HasForeignKey("PageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Gerbil", b =>
|
||||
{
|
||||
b.HasOne("GerbilManagerWebAPI.Models.ColorVariety", "ColorVariety")
|
||||
@@ -1030,6 +1252,11 @@ namespace GerbilManagerWebAPI.Migrations
|
||||
b.Navigation("Gerbils");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.Page", b =>
|
||||
{
|
||||
b.Navigation("Blocks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerbilManagerWebAPI.Models.SaleContract", b =>
|
||||
{
|
||||
b.Navigation("Animals");
|
||||
|
||||
Reference in New Issue
Block a user