Files
CMS/src/CMSMicroservice.Infrastructure/Persistence/Configurations/SitePageSettingsConfiguration.cs
T
masoodafar-web fd24dcebcd
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m2s
feat: Add SitePageSettings - simplified page management system
- 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
2026-02-17 22:34:29 +03:30

45 lines
1.3 KiB
C#

using CMSMicroservice.Domain.Entities.Content;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class SitePageSettingsConfiguration : IEntityTypeConfiguration<SitePageSettings>
{
public void Configure(EntityTypeBuilder<SitePageSettings> builder)
{
builder.ToTable("SitePageSettings");
builder.HasKey(x => x.Id);
builder.Property(x => x.PageKey)
.IsRequired()
.HasMaxLength(50);
builder.Property(x => x.Title)
.IsRequired()
.HasMaxLength(200);
builder.Property(x => x.MetaDescription)
.HasMaxLength(300);
builder.Property(x => x.HeroTitle)
.HasMaxLength(200);
builder.Property(x => x.HeroSubtitle)
.HasMaxLength(500);
builder.Property(x => x.IsActive)
.IsRequired()
.HasDefaultValue(true);
// SettingsJson — ستون JSON بدون محدودیت طول
builder.Property(x => x.SettingsJson)
.HasColumnType("nvarchar(max)");
// ایندکس یکتا روی PageKey
builder.HasIndex(x => x.PageKey)
.IsUnique()
.HasDatabaseName("IX_SitePageSettings_PageKey");
}
}