Files
CMS/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20260213123943_RemoveImagePathMaxLength.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

310 lines
10 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class RemoveImagePathMaxLength : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserOrders_OrderVATs_OrderVATId",
schema: "CMS",
table: "UserOrders");
migrationBuilder.DropIndex(
name: "IX_UserOrders_OrderVATId",
schema: "CMS",
table: "UserOrders");
migrationBuilder.DropColumn(
name: "OrderVATId",
schema: "CMS",
table: "UserOrders");
migrationBuilder.AlterColumn<string>(
name: "ImageThumbnailPath",
schema: "CMS",
table: "SitePageSections",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "SitePageSections",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "HeroImagePath",
schema: "CMS",
table: "SitePages",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "DiscountProducts",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountProducts",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500);
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "DiscountProductImages",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountProductImages",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountCategories",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FeaturedImageThumbnailPath",
schema: "CMS",
table: "BlogPosts",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FeaturedImagePath",
schema: "CMS",
table: "BlogPosts",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "BlogPostImages",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "BlogPostImages",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "OrderVATId",
schema: "CMS",
table: "UserOrders",
type: "bigint",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "ImageThumbnailPath",
schema: "CMS",
table: "SitePageSections",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "SitePageSections",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "HeroImagePath",
schema: "CMS",
table: "SitePages",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "DiscountProducts",
type: "nvarchar(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountProducts",
type: "nvarchar(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "DiscountProductImages",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountProductImages",
type: "nvarchar(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "DiscountCategories",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FeaturedImageThumbnailPath",
schema: "CMS",
table: "BlogPosts",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FeaturedImagePath",
schema: "CMS",
table: "BlogPosts",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ThumbnailPath",
schema: "CMS",
table: "BlogPostImages",
type: "nvarchar(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "ImagePath",
schema: "CMS",
table: "BlogPostImages",
type: "nvarchar(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.CreateIndex(
name: "IX_UserOrders_OrderVATId",
schema: "CMS",
table: "UserOrders",
column: "OrderVATId");
migrationBuilder.AddForeignKey(
name: "FK_UserOrders_OrderVATs_OrderVATId",
schema: "CMS",
table: "UserOrders",
column: "OrderVATId",
principalSchema: "CMS",
principalTable: "OrderVATs",
principalColumn: "Id");
}
}
}