Add validators and services for Product Galleries and Product Tags

- Implemented Create, Delete, Get, and Update validators for Product Galleries.
- Added Create, Delete, Get, and Update validators for Product Tags.
- Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags.
- Each service class integrates with CQRS for command and query handling.
- Established mapping profiles for Product Galleries.
This commit is contained in:
masoodafar-web
2025-12-04 02:40:49 +03:30
parent 40d54d08fc
commit f0f48118e7
436 changed files with 33159 additions and 2005 deletions
@@ -171,7 +171,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -813,7 +813,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -171,7 +171,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -816,7 +816,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -214,7 +214,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -905,7 +905,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -267,7 +267,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1088,7 +1088,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -267,7 +267,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1091,7 +1091,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -267,7 +267,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1044,7 +1044,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -267,7 +267,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1053,7 +1053,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -267,7 +267,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1062,7 +1062,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -937,7 +937,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1857,7 +1857,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -961,7 +961,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1881,7 +1881,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1031,7 +1031,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1951,7 +1951,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1042,7 +1042,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1962,7 +1962,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1042,7 +1042,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -1965,7 +1965,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1099,7 +1099,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -2045,7 +2045,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1111,7 +1111,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -2060,7 +2060,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -1111,7 +1111,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Packages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@@ -2066,7 +2066,7 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("User");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGallerys", b =>
modelBuilder.Entity("CMSMicroservice.Domain.Entities.ProductGalleries", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("ProductGalleryss")
@@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class RemoveParentIdFromUser : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Users_Users_ParentId",
schema: "CMS",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_ParentId",
schema: "CMS",
table: "Users");
migrationBuilder.DropColumn(
name: "ParentId",
schema: "CMS",
table: "Users");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "ParentId",
schema: "CMS",
table: "Users",
type: "bigint",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Users_ParentId",
schema: "CMS",
table: "Users",
column: "ParentId");
migrationBuilder.AddForeignKey(
name: "FK_Users_Users_ParentId",
schema: "CMS",
table: "Users",
column: "ParentId",
principalSchema: "CMS",
principalTable: "Users",
principalColumn: "Id");
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddGiftValueToClubMembership : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "GiftValue",
schema: "CMS",
table: "ClubMemberships",
type: "bigint",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GiftValue",
schema: "CMS",
table: "ClubMemberships");
}
}
}
@@ -0,0 +1,112 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddUserPackagePurchase : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "UserPackagePurchases",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<long>(type: "bigint", nullable: false),
PackageId = table.Column<long>(type: "bigint", nullable: false),
PurchaseMethod = table.Column<int>(type: "int", nullable: false),
PurchasedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
Amount = table.Column<long>(type: "bigint", nullable: false),
OrderId = table.Column<long>(type: "bigint", nullable: true),
TransactionId = table.Column<long>(type: "bigint", nullable: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserPackagePurchases", x => x.Id);
table.ForeignKey(
name: "FK_UserPackagePurchases_Packages_PackageId",
column: x => x.PackageId,
principalSchema: "CMS",
principalTable: "Packages",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserPackagePurchases_Transactionss_TransactionId",
column: x => x.TransactionId,
principalSchema: "CMS",
principalTable: "Transactionss",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserPackagePurchases_UserOrders_OrderId",
column: x => x.OrderId,
principalSchema: "CMS",
principalTable: "UserOrders",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserPackagePurchases_Users_UserId",
column: x => x.UserId,
principalSchema: "CMS",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchase_PackageId",
schema: "CMS",
table: "UserPackagePurchases",
column: "PackageId");
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchase_PurchasedAt",
schema: "CMS",
table: "UserPackagePurchases",
column: "PurchasedAt");
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchase_UserId",
schema: "CMS",
table: "UserPackagePurchases",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchase_UserId_PurchasedAt",
schema: "CMS",
table: "UserPackagePurchases",
columns: new[] { "UserId", "PurchasedAt" });
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchases_OrderId",
schema: "CMS",
table: "UserPackagePurchases",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_UserPackagePurchases_TransactionId",
schema: "CMS",
table: "UserPackagePurchases",
column: "TransactionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "UserPackagePurchases",
schema: "CMS");
}
}
}
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddClubMembershipGiftValueConfiguration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// اضافه کردن تنظیمات Club.MembershipGiftValue
migrationBuilder.Sql(@"
INSERT INTO ""SystemConfigurations""
(""Key"", ""Value"", ""Description"", ""Scope"", ""IsActive"", ""Created"", ""CreatedBy"")
SELECT
'Club.MembershipGiftValue',
'25200000',
'مبلغ هدیه حق عضویت باشگاه (ریال) - این مبلغ از کیف پول کم نمیشود',
1, -- ConfigurationScope.Club = 1
true,
NOW(),
'System'
WHERE NOT EXISTS (
SELECT 1 FROM ""SystemConfigurations""
WHERE ""Key"" = 'Club.MembershipGiftValue'
);
");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// حذف تنظیمات Club.MembershipGiftValue
migrationBuilder.Sql(@"
DELETE FROM ""SystemConfigurations""
WHERE ""Key"" = 'Club.MembershipGiftValue';
");
}
}
}
@@ -0,0 +1,108 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddManualPaymentSystem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ManualPayments",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<long>(type: "bigint", nullable: false),
Amount = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
ReferenceNumber = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
Status = table.Column<int>(type: "int", nullable: false),
RequestedBy = table.Column<long>(type: "bigint", nullable: false),
ApprovedBy = table.Column<long>(type: "bigint", nullable: true),
ApprovedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
RejectionReason = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
TransactionId = table.Column<long>(type: "bigint", nullable: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ManualPayments", x => x.Id);
table.ForeignKey(
name: "FK_ManualPayments_Transactionss_TransactionId",
column: x => x.TransactionId,
principalSchema: "CMS",
principalTable: "Transactionss",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ManualPayments_Users_UserId",
column: x => x.UserId,
principalSchema: "CMS",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_ApprovedBy",
schema: "CMS",
table: "ManualPayments",
column: "ApprovedBy");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_Created",
schema: "CMS",
table: "ManualPayments",
column: "Created");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_RequestedBy",
schema: "CMS",
table: "ManualPayments",
column: "RequestedBy");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_Status",
schema: "CMS",
table: "ManualPayments",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_TransactionId",
schema: "CMS",
table: "ManualPayments",
column: "TransactionId");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_UserId",
schema: "CMS",
table: "ManualPayments",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_ManualPayments_UserId_Status",
schema: "CMS",
table: "ManualPayments",
columns: new[] { "UserId", "Status" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ManualPayments",
schema: "CMS");
}
}
}
@@ -0,0 +1,94 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddPublicMessageSystem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PublicMessages",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Content = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
Type = table.Column<int>(type: "int", nullable: false),
Priority = table.Column<int>(type: "int", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
StartsAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedByUserId = table.Column<long>(type: "bigint", nullable: false),
ViewCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
LinkUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
LinkText = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PublicMessages", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_CreatedByUserId",
schema: "CMS",
table: "PublicMessages",
column: "CreatedByUserId");
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_ExpiresAt",
schema: "CMS",
table: "PublicMessages",
column: "ExpiresAt");
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_IsActive",
schema: "CMS",
table: "PublicMessages",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_IsActive_ExpiresAt",
schema: "CMS",
table: "PublicMessages",
columns: new[] { "IsActive", "ExpiresAt" });
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_Priority",
schema: "CMS",
table: "PublicMessages",
column: "Priority");
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_StartsAt",
schema: "CMS",
table: "PublicMessages",
column: "StartsAt");
migrationBuilder.CreateIndex(
name: "IX_PublicMessages_Type",
schema: "CMS",
table: "PublicMessages",
column: "Type");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PublicMessages",
schema: "CMS");
}
}
}
@@ -0,0 +1,125 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddVATSystem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "HasVAT",
schema: "CMS",
table: "UserOrders",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<long>(
name: "OrderVATId",
schema: "CMS",
table: "UserOrders",
type: "bigint",
nullable: true);
migrationBuilder.CreateTable(
name: "OrderVATs",
schema: "CMS",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OrderId = table.Column<long>(type: "bigint", nullable: false),
VATRate = table.Column<decimal>(type: "decimal(5,4)", nullable: false),
BaseAmount = table.Column<long>(type: "bigint", nullable: false),
VATAmount = table.Column<long>(type: "bigint", nullable: false),
TotalAmount = table.Column<long>(type: "bigint", nullable: false),
IsPaid = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PaidAt = table.Column<DateTime>(type: "datetime2", nullable: true),
Note = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderVATs", x => x.Id);
table.ForeignKey(
name: "FK_OrderVATs_UserOrders_OrderId",
column: x => x.OrderId,
principalSchema: "CMS",
principalTable: "UserOrders",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_UserOrders_OrderVATId",
schema: "CMS",
table: "UserOrders",
column: "OrderVATId");
migrationBuilder.CreateIndex(
name: "IX_OrderVATs_Created",
schema: "CMS",
table: "OrderVATs",
column: "Created");
migrationBuilder.CreateIndex(
name: "IX_OrderVATs_IsPaid",
schema: "CMS",
table: "OrderVATs",
column: "IsPaid");
migrationBuilder.CreateIndex(
name: "IX_OrderVATs_OrderId",
schema: "CMS",
table: "OrderVATs",
column: "OrderId",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_UserOrders_OrderVATs_OrderVATId",
schema: "CMS",
table: "UserOrders",
column: "OrderVATId",
principalSchema: "CMS",
principalTable: "OrderVATs",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserOrders_OrderVATs_OrderVATId",
schema: "CMS",
table: "UserOrders");
migrationBuilder.DropTable(
name: "OrderVATs",
schema: "CMS");
migrationBuilder.DropIndex(
name: "IX_UserOrders_OrderVATId",
schema: "CMS",
table: "UserOrders");
migrationBuilder.DropColumn(
name: "HasVAT",
schema: "CMS",
table: "UserOrders");
migrationBuilder.DropColumn(
name: "OrderVATId",
schema: "CMS",
table: "UserOrders");
}
}
}