Refactor: rename Price to Amount and update protobuf enums
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter;
|
||||
using BackOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder;
|
||||
using CMSMicroservice.Protobuf.Protos;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using CmsUserOrderFilter = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterFilter;
|
||||
using CmsUserOrderRequest = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterRequest;
|
||||
@@ -19,16 +21,15 @@ public class UserOrderProfile : IRegister
|
||||
.IgnoreIf((src, dest) => src.Filter.DeliveryStatus==null,dest => dest.Filter.DeliveryStatus)
|
||||
.IgnoreIf((src, dest) => src.Filter.PaymentMethod==null,dest => dest.Filter.PaymentMethod)
|
||||
.IgnoreIf((src, dest) => src.Filter.PaymentStatus==null,dest => dest.Filter.PaymentStatus)
|
||||
.Map(dest => dest.Filter, src => src.Filter == null || IsEmptyFilter(src.Filter) ? null : BuildFilter(src.Filter));
|
||||
|
||||
|
||||
|
||||
.Map(dest => dest.Filter, src => src.Filter == null || IsEmptyFilter(src.Filter) ? null : BuildFilter(src.Filter));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static bool IsEmptyFilter(GetAllUserOrderByFilterFilter src)
|
||||
{
|
||||
return src.Id == null
|
||||
&& src.Price == null
|
||||
&& src.Amount == null
|
||||
&& src.PackageId == null
|
||||
&& src.TransactionId == null
|
||||
&& src.PaymentStatus == null
|
||||
@@ -45,8 +46,8 @@ public class UserOrderProfile : IRegister
|
||||
if (src.Id.HasValue)
|
||||
filter.Id = src.Id.Value;
|
||||
|
||||
if (src.Price.HasValue)
|
||||
filter.Amount = src.Price.Value;
|
||||
if (src.Amount.HasValue)
|
||||
filter.Amount = src.Amount.Value;
|
||||
|
||||
if (src.PackageId.HasValue)
|
||||
filter.PackageId = src.PackageId.Value;
|
||||
@@ -64,17 +65,17 @@ public class UserOrderProfile : IRegister
|
||||
|
||||
if (src.PaymentStatus.HasValue)
|
||||
{
|
||||
filter.PaymentStatus = (CMSMicroservice.Protobuf.Protos.PaymentStatus)src.PaymentStatus.Value;
|
||||
filter.PaymentStatus = (PaymentStatus)src.PaymentStatus.Value;
|
||||
}
|
||||
|
||||
if (src.DeliveryStatus.HasValue)
|
||||
{
|
||||
filter.DeliveryStatus = (CMSMicroservice.Protobuf.Protos.DeliveryStatus)src.DeliveryStatus.Value;
|
||||
filter.DeliveryStatus = (DeliveryStatus)src.DeliveryStatus.Value;
|
||||
}
|
||||
|
||||
if (src.PaymentMethod.HasValue)
|
||||
{
|
||||
filter.PaymentMethod = (CMSMicroservice.Protobuf.Protos.PaymentMethod)src.PaymentMethod.Value;
|
||||
filter.PaymentMethod = (PaymentMethod)src.PaymentMethod.Value;
|
||||
}
|
||||
|
||||
return filter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter;
|
||||
public record GetAllUserOrderByFilterQuery : IRequest<GetAllUserOrderByFilterResponseDto>
|
||||
public record GetAllUserOrderByFilterQuery : IRequest<CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponse>
|
||||
{
|
||||
//موقعیت صفحه بندی
|
||||
public PaginationState? PaginationState { get; init; }
|
||||
@@ -12,8 +12,8 @@ public record GetAllUserOrderByFilterQuery : IRequest<GetAllUserOrderByFilterRes
|
||||
{
|
||||
//شناسه
|
||||
public long? Id { get; set; }
|
||||
//قیمت
|
||||
public long? Price { get; set; }
|
||||
//قیمت
|
||||
public long? Amount { get; set; }
|
||||
//شناسه پکیج
|
||||
public long? PackageId { get; set; }
|
||||
//شناسه تراکنش
|
||||
|
||||
@@ -13,7 +13,7 @@ public class GetAllUserOrderByFilterResponseModel
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//قیمت
|
||||
public long Price { get; set; }
|
||||
public long Amount { get; set; }
|
||||
//شناسه پکیج
|
||||
public long PackageId { get; set; }
|
||||
//شناسه تراکنش
|
||||
|
||||
@@ -5,7 +5,7 @@ public class GetUserOrderResponseDto
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//قیمت
|
||||
public long Price { get; set; }
|
||||
public long Amount { get; set; }
|
||||
//شناسه پکیج
|
||||
public long PackageId { get; set; }
|
||||
//شناسه تراکنش
|
||||
|
||||
@@ -10,6 +10,26 @@ import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder";
|
||||
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
enum DeliveryStatus
|
||||
{
|
||||
DeliveryStatus_None = 0;
|
||||
DeliveryStatus_Pending = 1;
|
||||
DeliveryStatus_InTransit = 2;
|
||||
DeliveryStatus_Delivered = 3;
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
|
||||
service UserOrderContract
|
||||
{
|
||||
rpc CreateNewUserOrder(CreateNewUserOrderRequest) returns (CreateNewUserOrderResponse){
|
||||
@@ -60,7 +80,7 @@ message UpdateUserOrderRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
// فیلدهای قدیمی (فعلاً برای سازگاری نگه داشته شدهاند)
|
||||
int64 price = 2;
|
||||
int64 amount = 2;
|
||||
int64 package_id = 3;
|
||||
google.protobuf.Int64Value transaction_id = 4;
|
||||
bool payment_status = 5;
|
||||
@@ -82,10 +102,13 @@ message GetUserOrderRequest
|
||||
message GetUserOrderResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 price = 2;
|
||||
int64 amount = 2;
|
||||
int64 package_id = 3;
|
||||
google.protobuf.Int64Value transaction_id = 4;
|
||||
bool payment_status = 5;
|
||||
oneof PaymentStatus_item
|
||||
{
|
||||
PaymentStatus payment_status = 5;
|
||||
}
|
||||
google.protobuf.Timestamp payment_date = 6;
|
||||
int64 user_id = 7;
|
||||
// شناسه آدرس کاربر
|
||||
@@ -94,8 +117,11 @@ message GetUserOrderResponse
|
||||
google.protobuf.StringValue user_address_text = 9;
|
||||
// جزئیات فاکتور
|
||||
repeated FactorDetailModel factor_details = 10;
|
||||
// وضعیت ارسال (مقدار عددی از DeliveryStatus در CMS)
|
||||
int32 delivery_status = 11;
|
||||
// وضعیت ارسال
|
||||
oneof DeliveryStatus_item
|
||||
{
|
||||
DeliveryStatus delivery_status = 11;
|
||||
}
|
||||
// کد رهگیری مرسوله
|
||||
google.protobuf.StringValue tracking_code = 12;
|
||||
// توضیحات وضعیت ارسال / نکات پستی
|
||||
@@ -104,8 +130,11 @@ message GetUserOrderResponse
|
||||
google.protobuf.StringValue user_full_name = 14;
|
||||
// کدملی کاربر
|
||||
google.protobuf.StringValue user_national_code = 15;
|
||||
// روش پرداخت (0=IPG,1=Wallet)
|
||||
int32 payment_method = 16;
|
||||
// روش پرداخت
|
||||
oneof PaymentMethod_item
|
||||
{
|
||||
PaymentMethod payment_method = 16;
|
||||
}
|
||||
}
|
||||
message GetAllUserOrderByFilterRequest
|
||||
{
|
||||
@@ -116,16 +145,16 @@ message GetAllUserOrderByFilterRequest
|
||||
message GetAllUserOrderByFilterFilter
|
||||
{
|
||||
google.protobuf.Int64Value id = 1;
|
||||
google.protobuf.Int64Value price = 2;
|
||||
google.protobuf.Int64Value amount = 2;
|
||||
google.protobuf.Int64Value package_id = 3;
|
||||
google.protobuf.Int64Value transaction_id = 4;
|
||||
google.protobuf.BoolValue payment_status = 5;
|
||||
google.protobuf.Int32Value payment_status = 5;
|
||||
google.protobuf.Timestamp payment_date = 6;
|
||||
google.protobuf.Int64Value user_id = 7;
|
||||
google.protobuf.Int64Value user_address_id = 8;
|
||||
// فیلتر وضعیت ارسال (مقدار عددی DeliveryStatus)
|
||||
// فیلتر وضعیت ارسال
|
||||
google.protobuf.Int32Value delivery_status = 9;
|
||||
// فیلتر روش پرداخت (0=IPG,1=Wallet)
|
||||
// فیلتر روش پرداخت
|
||||
google.protobuf.Int32Value payment_method = 10;
|
||||
}
|
||||
message GetAllUserOrderByFilterResponse
|
||||
@@ -136,18 +165,24 @@ message GetAllUserOrderByFilterResponse
|
||||
message GetAllUserOrderByFilterResponseModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 price = 2;
|
||||
int64 amount = 2;
|
||||
int64 package_id = 3;
|
||||
google.protobuf.Int64Value transaction_id = 4;
|
||||
bool payment_status = 5;
|
||||
oneof PaymentStatus_item
|
||||
{
|
||||
PaymentStatus payment_status = 5;
|
||||
}
|
||||
google.protobuf.Timestamp payment_date = 6;
|
||||
int64 user_id = 7;
|
||||
// شناسه آدرس کاربر
|
||||
google.protobuf.Int64Value user_address_id = 8;
|
||||
// متن آدرس کاربر
|
||||
google.protobuf.StringValue user_address_text = 9;
|
||||
// وضعیت ارسال (مقدار عددی از DeliveryStatus در CMS)
|
||||
int32 delivery_status = 10;
|
||||
// وضعیت ارسال
|
||||
oneof DeliveryStatus_item
|
||||
{
|
||||
DeliveryStatus delivery_status = 10;
|
||||
}
|
||||
// کد رهگیری مرسوله
|
||||
google.protobuf.StringValue tracking_code = 11;
|
||||
// توضیحات وضعیت ارسال / نکات پستی
|
||||
@@ -156,8 +191,11 @@ message GetAllUserOrderByFilterResponseModel
|
||||
google.protobuf.StringValue user_full_name = 13;
|
||||
// کدملی کاربر
|
||||
google.protobuf.StringValue user_national_code = 14;
|
||||
// روش پرداخت (0=IPG,1=Wallet)
|
||||
int32 payment_method = 15;
|
||||
// روش پرداخت
|
||||
oneof PaymentMethod_item
|
||||
{
|
||||
PaymentMethod payment_method = 15;
|
||||
}
|
||||
}
|
||||
|
||||
// جزئیات فاکتور سفارش
|
||||
|
||||
Reference in New Issue
Block a user