feat: Add SitePageSettings - simplified page management system
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m2s

- New entities: SitePageSettings + SitePageImage (4 fixed pages)
- EF Migration: AddSitePageSettings (SitePageSettings + SitePageImages tables)
- Proto: sitepagesettings.proto with 5 RPCs
- CQRS: GetPageSettings, GetAllPageSettings, SavePageSettings, SavePageImage, DeletePageImage
- gRPC Service: SitePageSettingsService (auto-registered)
- Proto NuGet bumped to 0.0.180
This commit is contained in:
masoodafar-web
2026-02-17 22:34:29 +03:30
parent 89e146bf32
commit fd24dcebcd
18 changed files with 5860 additions and 1 deletions
@@ -0,0 +1,102 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddSitePageSettings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SitePageSettings",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PageKey = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
MetaDescription = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
HeroTitle = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
HeroSubtitle = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
HeroImagePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
SettingsJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SitePageSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SitePageImages",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SitePageSettingsId = table.Column<long>(type: "bigint", nullable: false),
ImageGroup = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Subtitle = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
ImagePath = table.Column<string>(type: "nvarchar(max)", nullable: false),
ThumbnailPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
LinkUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
IconName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
SortOrder = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SitePageImages", x => x.Id);
table.ForeignKey(
name: "FK_SitePageImages_SitePageSettings_SitePageSettingsId",
column: x => x.SitePageSettingsId,
principalSchema: "CMS",
principalTable: "SitePageSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SitePageImages_SettingsId_Group",
schema: "CMS",
table: "SitePageImages",
columns: new[] { "SitePageSettingsId", "ImageGroup" });
migrationBuilder.CreateIndex(
name: "IX_SitePageSettings_PageKey",
schema: "CMS",
table: "SitePageSettings",
column: "PageKey",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SitePageImages",
schema: "CMS");
migrationBuilder.DropTable(
name: "SitePageSettings",
schema: "CMS");
}
}
}
@@ -826,6 +826,81 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("SitePages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageImage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("IconName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ImageGroup")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ImagePath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("LinkUrl")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<long>("SitePageSettingsId")
.HasColumnType("bigint");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("Subtitle")
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<string>("ThumbnailPath")
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("SitePageSettingsId", "ImageGroup")
.HasDatabaseName("IX_SitePageImages_SettingsId_Group");
b.ToTable("SitePageImages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSection", b =>
{
b.Property<long>("Id")
@@ -900,6 +975,71 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("SitePageSections", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("HeroImagePath")
.HasColumnType("nvarchar(max)");
b.Property<string>("HeroSubtitle")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("HeroTitle")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("MetaDescription")
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<string>("PageKey")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("SettingsJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("PageKey")
.IsUnique()
.HasDatabaseName("IX_SitePageSettings_PageKey");
b.ToTable("SitePageSettings", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Contract", b =>
{
b.Property<long>("Id")
@@ -3807,6 +3947,17 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("WeekDefinition");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageImage", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Content.SitePageSettings", "SitePageSettings")
.WithMany("Images")
.HasForeignKey("SitePageSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SitePageSettings");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSection", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Content.SitePage", "SitePage")
@@ -4363,6 +4514,11 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Sections");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSettings", b =>
{
b.Navigation("Images");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Contract", b =>
{
b.Navigation("UserContracts");