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
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:
+25
@@ -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");
|
||||
}
|
||||
}
|
||||
+22
@@ -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);
|
||||
}
|
||||
}
|
||||
+35
@@ -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");
|
||||
}
|
||||
}
|
||||
+25
@@ -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);
|
||||
}
|
||||
}
|
||||
+22
@@ -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);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using CMSMicroservice.Domain.Entities.Content;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Content;
|
||||
|
||||
public class SitePageConfiguration : IEntityTypeConfiguration<SitePage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SitePage> builder)
|
||||
{
|
||||
builder.ToTable("SitePages");
|
||||
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.HeroImagePath);
|
||||
builder.Property(x => x.IsActive).IsRequired().HasDefaultValue(true);
|
||||
|
||||
// Indexes
|
||||
builder.HasIndex(x => x.PageKey).IsUnique().HasDatabaseName("IX_SitePages_PageKey");
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using CMSMicroservice.Domain.Entities.Content;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations.Content;
|
||||
|
||||
public class SitePageSectionConfiguration : IEntityTypeConfiguration<SitePageSection>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SitePageSection> builder)
|
||||
{
|
||||
builder.ToTable("SitePageSections");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.SitePageId).IsRequired();
|
||||
builder.Property(x => x.SectionKey).IsRequired().HasMaxLength(100);
|
||||
builder.Property(x => x.Title).IsRequired().HasMaxLength(200);
|
||||
builder.Property(x => x.Subtitle).HasMaxLength(300);
|
||||
builder.Property(x => x.IconName).HasMaxLength(100);
|
||||
builder.Property(x => x.ImagePath);
|
||||
builder.Property(x => x.ImageThumbnailPath);
|
||||
builder.Property(x => x.SortOrder).IsRequired().HasDefaultValue(0);
|
||||
builder.Property(x => x.IsActive).IsRequired().HasDefaultValue(true);
|
||||
|
||||
builder.HasOne(d => d.SitePage)
|
||||
.WithMany(p => p.Sections)
|
||||
.HasForeignKey(d => d.SitePageId);
|
||||
|
||||
// Indexes
|
||||
builder.HasIndex(x => new { x.SitePageId, x.SectionKey })
|
||||
.HasDatabaseName("IX_SitePageSections_PageId_SectionKey");
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -28,8 +28,7 @@ public class DiscountCategoryConfiguration : IEntityTypeConfiguration<DiscountCa
|
||||
builder.Property(entity => entity.Description)
|
||||
.HasMaxLength(1000);
|
||||
|
||||
builder.Property(entity => entity.ImagePath)
|
||||
.HasMaxLength(500);
|
||||
builder.Property(entity => entity.ImagePath);
|
||||
|
||||
builder.Property(entity => entity.IsActive)
|
||||
.IsRequired()
|
||||
|
||||
+2
-4
@@ -36,12 +36,10 @@ public class DiscountProductConfiguration : IEntityTypeConfiguration<DiscountPro
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(entity => entity.ImagePath)
|
||||
.IsRequired()
|
||||
.HasMaxLength(500);
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(entity => entity.ThumbnailPath)
|
||||
.IsRequired()
|
||||
.HasMaxLength(500);
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(entity => entity.IsActive)
|
||||
.IsRequired()
|
||||
|
||||
+2
-4
@@ -19,11 +19,9 @@ public class DiscountProductImageConfiguration : IEntityTypeConfiguration<Discou
|
||||
.HasMaxLength(500);
|
||||
|
||||
builder.Property(x => x.ImagePath)
|
||||
.IsRequired()
|
||||
.HasMaxLength(500);
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.ThumbnailPath)
|
||||
.HasMaxLength(500);
|
||||
builder.Property(x => x.ThumbnailPath);
|
||||
|
||||
builder.HasOne(x => x.DiscountProduct)
|
||||
.WithMany(p => p.Images)
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ public class ManualPaymentConfiguration : IEntityTypeConfiguration<ManualPayment
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ManualPayment> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.ToTable("ManualPayments");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ public class OrderVATConfiguration : IEntityTypeConfiguration<OrderVAT>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<OrderVAT> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.ToTable("OrderVATs");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
@@ -37,7 +38,7 @@ public class OrderVATConfiguration : IEntityTypeConfiguration<OrderVAT>
|
||||
|
||||
// Foreign Key
|
||||
builder.HasOne(x => x.Order)
|
||||
.WithOne()
|
||||
.WithOne(x => x.OrderVAT)
|
||||
.HasForeignKey<OrderVAT>(x => x.OrderId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ public class ProductCategoryConfiguration : IEntityTypeConfiguration<ProductCate
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProductCategory> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.ToTable("ProductCategories", "CMS");
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ public class ProductTagConfiguration : IEntityTypeConfiguration<ProductTag>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProductTag> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.ToTable("ProductTags", "CMS");
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ public class PublicMessageConfiguration : IEntityTypeConfiguration<PublicMessage
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PublicMessage> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.ToTable("PublicMessages");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
Reference in New Issue
Block a user