Files
CMS/src/CMSMicroservice.Infrastructure/Persistence/Configurations/PublicMessageConfiguration.cs
T
masoodafar-web 2502cbbda2
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m44s
feat: integrate PYMS payment gateway, add blog/sitepage/image services, local file manager
Payment Gateway:
- Add PYMSPaymentService: IPaymentGatewayService via gRPC to PYMS microservice
- Add ZarinPalPaymentService: direct ZarinPal integration (backup)
- Register 'pyms' payment provider in DI ConfigureServices
- Add PYMS proto files (pyms_transaction.proto, pyms_public_messages.proto)
- Fix VerifyDiscountWalletCharge: pass 'OK' as status instead of Authority
- Update appsettings: PaymentProvider=pyms, sandbox mode, merchant ID

Blog System:
- Add BlogCategory, BlogPost, BlogPostImage entities and CQRS
- Add proto files and gRPC services for blog management
- Add Mapster profiles for blog responses

Content Management:
- Add SitePage entity and CQRS for static pages
- Add proto and gRPC service for site pages

Image/File Management:
- Add LocalFileManager with disk storage + base64 serving + FMS fallback
- Add ImagePathResolverInterceptor for gRPC responses
- Add ImageResolverService for explicit image resolution
- Add UploadsController for public file serving with FMS fallback
- Add PaymentCallbackController for discount order payment callbacks

Database:
- Add blog and content entity migrations
- Remove ImagePath MaxLength constraints
- Remove old FileManagementService (replaced by LocalFileManager)
2026-02-15 23:01:16 +03:30

76 lines
2.1 KiB
C#

using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class PublicMessageConfiguration : IEntityTypeConfiguration<PublicMessage>
{
public void Configure(EntityTypeBuilder<PublicMessage> builder)
{
builder.HasQueryFilter(p => !p.IsDeleted);
builder.ToTable("PublicMessages");
builder.HasKey(x => x.Id);
builder.Property(x => x.Title)
.IsRequired()
.HasMaxLength(200);
builder.Property(x => x.Content)
.IsRequired()
.HasMaxLength(2000);
builder.Property(x => x.Type)
.IsRequired();
builder.Property(x => x.Priority)
.IsRequired();
builder.Property(x => x.IsActive)
.IsRequired()
.HasDefaultValue(true);
builder.Property(x => x.StartsAt)
.IsRequired();
builder.Property(x => x.ExpiresAt)
.IsRequired();
builder.Property(x => x.CreatedByUserId)
.IsRequired();
builder.Property(x => x.ViewCount)
.IsRequired()
.HasDefaultValue(0);
builder.Property(x => x.LinkUrl)
.HasMaxLength(500);
builder.Property(x => x.LinkText)
.HasMaxLength(100);
// Indexes
builder.HasIndex(x => x.IsActive)
.HasDatabaseName("IX_PublicMessages_IsActive");
builder.HasIndex(x => x.Type)
.HasDatabaseName("IX_PublicMessages_Type");
builder.HasIndex(x => x.Priority)
.HasDatabaseName("IX_PublicMessages_Priority");
builder.HasIndex(x => x.StartsAt)
.HasDatabaseName("IX_PublicMessages_StartsAt");
builder.HasIndex(x => x.ExpiresAt)
.HasDatabaseName("IX_PublicMessages_ExpiresAt");
builder.HasIndex(x => x.CreatedByUserId)
.HasDatabaseName("IX_PublicMessages_CreatedByUserId");
builder.HasIndex(x => new { x.IsActive, x.ExpiresAt })
.HasDatabaseName("IX_PublicMessages_IsActive_ExpiresAt");
}
}