feat(migrations): add ImageDocumentId column to ManualPayments table
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m36s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m36s
feat(mappings): implement DiscountCategoryProfile for mapping between application DTOs and protobuf responses
This commit is contained in:
+5
-5
@@ -73,12 +73,12 @@ public class CreateManualPaymentCommandHandler : IRequestHandler<CreateManualPay
|
|||||||
// 4. محاسبه مبالغ
|
// 4. محاسبه مبالغ
|
||||||
var balanceAmount = SystemConstants.BasePackageAmount; // 56M
|
var balanceAmount = SystemConstants.BasePackageAmount; // 56M
|
||||||
var discountBalanceAmount = SystemConstants.BasePackageAmount * 2; // 112M
|
var discountBalanceAmount = SystemConstants.BasePackageAmount * 2; // 112M
|
||||||
var totalAmount = balanceAmount + discountBalanceAmount; // 168M
|
|
||||||
|
|
||||||
// 5. ثبت تراکنش
|
// 5. ثبت تراکنش
|
||||||
var transaction = new Transaction
|
var transaction = new Transaction
|
||||||
{
|
{
|
||||||
Amount = totalAmount,
|
Amount = balanceAmount,
|
||||||
Description = $"عضویت دستی باشگاه مشتریان - {request.Description} - مرجع: {request.ReferenceNumber}",
|
Description = $"عضویت دستی باشگاه مشتریان - {request.Description} - مرجع: {request.ReferenceNumber}",
|
||||||
PaymentStatus = PaymentStatus.Success,
|
PaymentStatus = PaymentStatus.Success,
|
||||||
PaymentDate = DateTime.Now,
|
PaymentDate = DateTime.Now,
|
||||||
@@ -93,7 +93,7 @@ public class CreateManualPaymentCommandHandler : IRequestHandler<CreateManualPay
|
|||||||
var manualPayment = new ManualPayment
|
var manualPayment = new ManualPayment
|
||||||
{
|
{
|
||||||
UserId = request.UserId,
|
UserId = request.UserId,
|
||||||
Amount = totalAmount,
|
Amount = balanceAmount,
|
||||||
Type = request.Type,
|
Type = request.Type,
|
||||||
Description = request.Description,
|
Description = request.Description,
|
||||||
ReferenceNumber = request.ReferenceNumber,
|
ReferenceNumber = request.ReferenceNumber,
|
||||||
@@ -119,11 +119,11 @@ public class CreateManualPaymentCommandHandler : IRequestHandler<CreateManualPay
|
|||||||
var walletLog = new UserWalletChangeLog
|
var walletLog = new UserWalletChangeLog
|
||||||
{
|
{
|
||||||
WalletId = wallet.Id,
|
WalletId = wallet.Id,
|
||||||
CurrentBalance = wallet.Balance,
|
CurrentBalance = 0,
|
||||||
ChangeValue = balanceAmount,
|
ChangeValue = balanceAmount,
|
||||||
CurrentNetworkBalance = wallet.NetworkBalance,
|
CurrentNetworkBalance = wallet.NetworkBalance,
|
||||||
ChangeNerworkValue = 0,
|
ChangeNerworkValue = 0,
|
||||||
CurrentDiscountBalance = wallet.DiscountBalance,
|
CurrentDiscountBalance =0,
|
||||||
ChangeDiscountValue = discountBalanceAmount,
|
ChangeDiscountValue = discountBalanceAmount,
|
||||||
IsIncrease = true,
|
IsIncrease = true,
|
||||||
RefrenceId = transaction.Id
|
RefrenceId = transaction.Id
|
||||||
|
|||||||
+3948
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class u20 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<long>(
|
||||||
|
name: "ImageDocumentId",
|
||||||
|
schema: "CMS",
|
||||||
|
table: "ManualPayments",
|
||||||
|
type: "bigint",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ImageDocumentId",
|
||||||
|
schema: "CMS",
|
||||||
|
table: "ManualPayments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -1879,6 +1879,9 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
|||||||
.HasMaxLength(1000)
|
.HasMaxLength(1000)
|
||||||
.HasColumnType("nvarchar(1000)");
|
.HasColumnType("nvarchar(1000)");
|
||||||
|
|
||||||
|
b.Property<long?>("ImageDocumentId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<string>("ImagePath")
|
b.Property<string>("ImagePath")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.0.167</Version>
|
<Version>0.0.168</Version>
|
||||||
<DebugType>None</DebugType>
|
<DebugType>None</DebugType>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using CMSMicroservice.Application.DiscountShopCQ.Queries.GetDiscountCategories;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.DiscountCategory;
|
||||||
|
using Mapster;
|
||||||
|
using AppDiscountCategoryDto = CMSMicroservice.Application.DiscountShopCQ.Queries.GetDiscountCategories.DiscountCategoryDto;
|
||||||
|
using ProtoDiscountCategoryDto = CMSMicroservice.Protobuf.Protos.DiscountCategory.DiscountCategoryDto;
|
||||||
|
|
||||||
|
namespace CMSMicroservice.WebApi.Common.Mappings;
|
||||||
|
|
||||||
|
public class DiscountCategoryProfile : IRegister
|
||||||
|
{
|
||||||
|
void IRegister.Register(TypeAdapterConfig config)
|
||||||
|
{
|
||||||
|
// Map from Application DTO to Proto Response
|
||||||
|
config.NewConfig<GetDiscountCategoriesResponseDto, GetDiscountCategoriesResponse>()
|
||||||
|
.MapWith(src => MapToResponse(src));
|
||||||
|
|
||||||
|
// Map individual category DTO
|
||||||
|
config.NewConfig<AppDiscountCategoryDto, ProtoDiscountCategoryDto>()
|
||||||
|
.MapWith(src => MapCategory(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static GetDiscountCategoriesResponse MapToResponse(GetDiscountCategoriesResponseDto src)
|
||||||
|
{
|
||||||
|
var response = new GetDiscountCategoriesResponse();
|
||||||
|
if (src.Categories != null)
|
||||||
|
{
|
||||||
|
foreach (var category in src.Categories)
|
||||||
|
{
|
||||||
|
response.Categories.Add(MapCategory(category));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ProtoDiscountCategoryDto MapCategory(AppDiscountCategoryDto src)
|
||||||
|
{
|
||||||
|
var proto = new ProtoDiscountCategoryDto
|
||||||
|
{
|
||||||
|
Id = src.Id,
|
||||||
|
Name = src.Name ?? string.Empty,
|
||||||
|
Title = src.Title ?? string.Empty,
|
||||||
|
Description = src.Description,
|
||||||
|
ImagePath = src.ImagePath,
|
||||||
|
ParentCategoryId = src.ParentCategoryId,
|
||||||
|
SortOrder = src.SortOrder,
|
||||||
|
IsActive = src.IsActive,
|
||||||
|
ProductCount = src.ProductCount
|
||||||
|
};
|
||||||
|
|
||||||
|
// Recursively map children
|
||||||
|
if (src.Children != null)
|
||||||
|
{
|
||||||
|
foreach (var child in src.Children)
|
||||||
|
{
|
||||||
|
proto.Children.Add(MapCategory(child));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return proto;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user