feat: integrate PYMS payment gateway, add blog/sitepage/image services, local file manager
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m44s

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)
This commit is contained in:
masoodafar-web
2026-02-15 23:01:16 +03:30
parent 5a4e4a960d
commit 2502cbbda2
177 changed files with 16632 additions and 487 deletions
@@ -0,0 +1,25 @@
using CMSMicroservice.Domain.Entities.Blog;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Blog;
public class BlogCategoryConfiguration : IEntityTypeConfiguration<BlogCategory>
{
public void Configure(EntityTypeBuilder<BlogCategory> builder)
{
builder.ToTable("BlogCategories");
builder.HasKey(x => x.Id);
builder.Property(x => x.Title).IsRequired().HasMaxLength(100);
builder.Property(x => x.Slug).IsRequired().HasMaxLength(100);
builder.Property(x => x.Description).HasMaxLength(500);
builder.Property(x => x.IconName).HasMaxLength(100);
builder.Property(x => x.SortOrder).IsRequired().HasDefaultValue(0);
builder.Property(x => x.IsActive).IsRequired().HasDefaultValue(true);
// Indexes
builder.HasIndex(x => x.Slug).IsUnique().HasDatabaseName("IX_BlogCategories_Slug");
builder.HasIndex(x => x.IsActive).HasDatabaseName("IX_BlogCategories_IsActive");
}
}
@@ -0,0 +1,22 @@
using CMSMicroservice.Domain.Entities.Blog;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Blog;
public class BlogPostCategoryConfiguration : IEntityTypeConfiguration<BlogPostCategory>
{
public void Configure(EntityTypeBuilder<BlogPostCategory> builder)
{
builder.ToTable("BlogPostCategories");
builder.HasKey(e => e.Id);
builder.HasOne(d => d.BlogPost)
.WithMany(p => p.BlogPostCategories)
.HasForeignKey(d => d.BlogPostId);
builder.HasOne(d => d.BlogCategory)
.WithMany(p => p.BlogPostCategories)
.HasForeignKey(d => d.BlogCategoryId);
}
}
@@ -0,0 +1,35 @@
using CMSMicroservice.Domain.Entities.Blog;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Blog;
public class BlogPostConfiguration : IEntityTypeConfiguration<BlogPost>
{
public void Configure(EntityTypeBuilder<BlogPost> builder)
{
builder.ToTable("BlogPosts");
builder.HasKey(x => x.Id);
builder.Property(x => x.Title).IsRequired().HasMaxLength(200);
builder.Property(x => x.Slug).IsRequired().HasMaxLength(200);
builder.Property(x => x.Summary).HasMaxLength(500);
builder.Property(x => x.HtmlContent).IsRequired();
builder.Property(x => x.FeaturedImagePath);
builder.Property(x => x.FeaturedImageThumbnailPath);
builder.Property(x => x.Status).IsRequired();
builder.Property(x => x.ViewCount).IsRequired().HasDefaultValue(0);
builder.Property(x => x.AuthorUserId).IsRequired();
builder.Property(x => x.IsFeatured).IsRequired().HasDefaultValue(false);
builder.Property(x => x.SortOrder).IsRequired().HasDefaultValue(0);
// Indexes
builder.HasIndex(x => x.Slug).IsUnique().HasDatabaseName("IX_BlogPosts_Slug");
builder.HasIndex(x => x.Status).HasDatabaseName("IX_BlogPosts_Status");
builder.HasIndex(x => x.PublishedAt).HasDatabaseName("IX_BlogPosts_PublishedAt");
builder.HasIndex(x => x.IsFeatured).HasDatabaseName("IX_BlogPosts_IsFeatured");
builder.HasIndex(x => x.AuthorUserId).HasDatabaseName("IX_BlogPosts_AuthorUserId");
builder.HasIndex(x => new { x.Status, x.PublishedAt })
.HasDatabaseName("IX_BlogPosts_Status_PublishedAt");
}
}
@@ -0,0 +1,25 @@
using CMSMicroservice.Domain.Entities.Blog;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Blog;
public class BlogPostImageConfiguration : IEntityTypeConfiguration<BlogPostImage>
{
public void Configure(EntityTypeBuilder<BlogPostImage> builder)
{
builder.ToTable("BlogPostImages");
builder.HasKey(x => x.Id);
builder.Property(x => x.BlogPostId).IsRequired();
builder.Property(x => x.ImagePath).IsRequired();
builder.Property(x => x.ThumbnailPath).IsRequired();
builder.Property(x => x.AltText).HasMaxLength(200);
builder.Property(x => x.Caption).HasMaxLength(300);
builder.Property(x => x.SortOrder).IsRequired().HasDefaultValue(0);
builder.HasOne(d => d.BlogPost)
.WithMany(p => p.BlogPostImages)
.HasForeignKey(d => d.BlogPostId);
}
}
@@ -0,0 +1,22 @@
using CMSMicroservice.Domain.Entities.Blog;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Blog;
public class BlogPostTagConfiguration : IEntityTypeConfiguration<BlogPostTag>
{
public void Configure(EntityTypeBuilder<BlogPostTag> builder)
{
builder.ToTable("BlogPostTags");
builder.HasKey(e => e.Id);
builder.HasOne(d => d.BlogPost)
.WithMany(p => p.BlogPostTags)
.HasForeignKey(d => d.BlogPostId);
builder.HasOne(d => d.Tag)
.WithMany()
.HasForeignKey(d => d.TagId);
}
}