Generator Changes at 10/13/2025 8:22:12 AM
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserAddressCQ.Commands.SetAddressAsDefault;
|
||||||
|
public record SetAddressAsDefaultCommand : IRequest<Unit>
|
||||||
|
{
|
||||||
|
//شناسه
|
||||||
|
public long Id { get; init; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||||
|
|
||||||
|
namespace FrontOffice.BFF.Application.UserAddressCQ.Commands.SetAddressAsDefault;
|
||||||
|
public class SetAddressAsDefaultCommandHandler : IRequestHandler<SetAddressAsDefaultCommand, Unit>
|
||||||
|
{
|
||||||
|
private readonly IApplicationContractContext _context;
|
||||||
|
|
||||||
|
public SetAddressAsDefaultCommandHandler(IApplicationContractContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Unit> Handle(SetAddressAsDefaultCommand request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await _context.UserAddress.SetAddressAsDefaultAsync(request:request.Adapt<SetAddressAsDefaultRequest>(),cancellationToken:cancellationToken);
|
||||||
|
return Unit.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserAddressCQ.Commands.SetAddressAsDefault;
|
||||||
|
public class SetAddressAsDefaultCommandValidator : AbstractValidator<SetAddressAsDefaultCommand>
|
||||||
|
{
|
||||||
|
public SetAddressAsDefaultCommandValidator()
|
||||||
|
{
|
||||||
|
RuleFor(model => model.Id)
|
||||||
|
.NotNull();
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<SetAddressAsDefaultCommand>.CreateWithOptions((SetAddressAsDefaultCommand)model, x => x.IncludeProperties(propertyName)));
|
||||||
|
if (result.IsValid)
|
||||||
|
return Array.Empty<string>();
|
||||||
|
return result.Errors.Select(e => e.ErrorMessage);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -13,6 +13,14 @@ public record UpdateUserCommand : IRequest<Unit>
|
|||||||
public string? AvatarPath { get; init; }
|
public string? AvatarPath { get; init; }
|
||||||
//فایل آواتار
|
//فایل آواتار
|
||||||
public UserAvatarFileModel? AvatarFile { get; init; }
|
public UserAvatarFileModel? AvatarFile { get; init; }
|
||||||
|
//اعلان ایمیل
|
||||||
|
public bool EmailNotifications { get; init; }
|
||||||
|
//اعلان پیامک
|
||||||
|
public bool SmsNotifications { get; init; }
|
||||||
|
//اعلان پوش
|
||||||
|
public bool PushNotifications { get; init; }
|
||||||
|
//تاریخ تولد
|
||||||
|
public DateTime? BirthDate { get; init; }
|
||||||
|
|
||||||
}public class UserAvatarFileModel
|
}public class UserAvatarFileModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ public class UpdateUserCommandValidator : AbstractValidator<UpdateUserCommand>
|
|||||||
{
|
{
|
||||||
RuleFor(model => model.Id)
|
RuleFor(model => model.Id)
|
||||||
.NotNull();
|
.NotNull();
|
||||||
|
RuleFor(model => model.EmailNotifications)
|
||||||
|
.NotNull();
|
||||||
|
RuleFor(model => model.SmsNotifications)
|
||||||
|
.NotNull();
|
||||||
|
RuleFor(model => model.PushNotifications)
|
||||||
|
.NotNull();
|
||||||
}
|
}
|
||||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,4 +28,12 @@ public record GetAllUserByFilterQuery : IRequest<GetAllUserByFilterResponseDto>
|
|||||||
public string? ReferralCode { get; set; }
|
public string? ReferralCode { get; set; }
|
||||||
//موبایل فعال شده؟
|
//موبایل فعال شده؟
|
||||||
public bool? IsMobileVerified { get; set; }
|
public bool? IsMobileVerified { get; set; }
|
||||||
|
//اعلان ایمیل
|
||||||
|
public bool? EmailNotifications { get; set; }
|
||||||
|
//اعلان پیامک
|
||||||
|
public bool? SmsNotifications { get; set; }
|
||||||
|
//اعلان پوش
|
||||||
|
public bool? PushNotifications { get; set; }
|
||||||
|
//تاریخ تولد
|
||||||
|
public DateTime? BirthDate { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,12 @@ public class GetAllUserByFilterResponseDto
|
|||||||
public bool IsMobileVerified { get; set; }
|
public bool IsMobileVerified { get; set; }
|
||||||
//تاریخ فعال سازی موبایل
|
//تاریخ فعال سازی موبایل
|
||||||
public DateTime? MobileVerifiedAt { get; set; }
|
public DateTime? MobileVerifiedAt { get; set; }
|
||||||
|
//اعلان ایمیل
|
||||||
|
public bool EmailNotifications { get; set; }
|
||||||
|
//اعلان پیامک
|
||||||
|
public bool SmsNotifications { get; set; }
|
||||||
|
//اعلان پوش
|
||||||
|
public bool PushNotifications { get; set; }
|
||||||
|
//تاریخ تولد
|
||||||
|
public DateTime? BirthDate { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,5 +23,13 @@ public class GetUserResponseDto
|
|||||||
public bool IsMobileVerified { get; set; }
|
public bool IsMobileVerified { get; set; }
|
||||||
//تاریخ فعال سازی موبایل
|
//تاریخ فعال سازی موبایل
|
||||||
public DateTime? MobileVerifiedAt { get; set; }
|
public DateTime? MobileVerifiedAt { get; set; }
|
||||||
|
//اعلان ایمیل
|
||||||
|
public bool EmailNotifications { get; set; }
|
||||||
|
//اعلان پیامک
|
||||||
|
public bool SmsNotifications { get; set; }
|
||||||
|
//اعلان پوش
|
||||||
|
public bool PushNotifications { get; set; }
|
||||||
|
//تاریخ تولد
|
||||||
|
public DateTime? BirthDate { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,5 +13,7 @@ public record CreateNewUserOrderCommand : IRequest<CreateNewUserOrderResponseDto
|
|||||||
public DateTime? PaymentDate { get; init; }
|
public DateTime? PaymentDate { get; init; }
|
||||||
//شناسه کاربر
|
//شناسه کاربر
|
||||||
public long UserId { get; init; }
|
public long UserId { get; init; }
|
||||||
|
//شناسه آدرس کاربر
|
||||||
|
public long UserAddressId { get; init; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,8 @@ public class CreateNewUserOrderCommandValidator : AbstractValidator<CreateNewUse
|
|||||||
.NotNull();
|
.NotNull();
|
||||||
RuleFor(model => model.UserId)
|
RuleFor(model => model.UserId)
|
||||||
.NotNull();
|
.NotNull();
|
||||||
|
RuleFor(model => model.UserAddressId)
|
||||||
|
.NotNull();
|
||||||
}
|
}
|
||||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,4 +24,6 @@ public record GetAllUserOrderByFilterQuery : IRequest<GetAllUserOrderByFilterRes
|
|||||||
public DateTime? PaymentDate { get; set; }
|
public DateTime? PaymentDate { get; set; }
|
||||||
//شناسه کاربر
|
//شناسه کاربر
|
||||||
public long? UserId { get; set; }
|
public long? UserId { get; set; }
|
||||||
|
//شناسه آدرس کاربر
|
||||||
|
public long? UserAddressId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ public class GetAllUserOrderByFilterResponseDto
|
|||||||
public DateTime? PaymentDate { get; set; }
|
public DateTime? PaymentDate { get; set; }
|
||||||
//شناسه کاربر
|
//شناسه کاربر
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
|
//شناسه آدرس کاربر
|
||||||
|
public long UserAddressId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,7 @@ public class GetUserOrderResponseDto
|
|||||||
public DateTime? PaymentDate { get; set; }
|
public DateTime? PaymentDate { get; set; }
|
||||||
//شناسه کاربر
|
//شناسه کاربر
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
|
//شناسه آدرس کاربر
|
||||||
|
public long UserAddressId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.116" />
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.117" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using FrontOffice.BFF.Application.UserAddressCQ.Commands.UpdateUserAddress;
|
|||||||
using FrontOffice.BFF.Application.UserAddressCQ.Commands.DeleteUserAddress;
|
using FrontOffice.BFF.Application.UserAddressCQ.Commands.DeleteUserAddress;
|
||||||
using FrontOffice.BFF.Application.UserAddressCQ.Queries.GetUserAddress;
|
using FrontOffice.BFF.Application.UserAddressCQ.Queries.GetUserAddress;
|
||||||
using FrontOffice.BFF.Application.UserAddressCQ.Queries.GetAllUserAddressByFilter;
|
using FrontOffice.BFF.Application.UserAddressCQ.Queries.GetAllUserAddressByFilter;
|
||||||
|
using FrontOffice.BFF.Application.UserAddressCQ.Commands.SetAddressAsDefault;
|
||||||
namespace FrontOffice.BFF.WebApi.Services;
|
namespace FrontOffice.BFF.WebApi.Services;
|
||||||
public class UserAddressService : UserAddressContract.UserAddressContractBase
|
public class UserAddressService : UserAddressContract.UserAddressContractBase
|
||||||
{
|
{
|
||||||
@@ -34,4 +35,8 @@ public class UserAddressService : UserAddressContract.UserAddressContractBase
|
|||||||
{
|
{
|
||||||
return await _dispatchRequestToCQRS.Handle<GetAllUserAddressByFilterRequest, GetAllUserAddressByFilterQuery, GetAllUserAddressByFilterResponse>(request, context);
|
return await _dispatchRequestToCQRS.Handle<GetAllUserAddressByFilterRequest, GetAllUserAddressByFilterQuery, GetAllUserAddressByFilterResponse>(request, context);
|
||||||
}
|
}
|
||||||
|
public override async Task<Empty> SetAddressAsDefault(SetAddressAsDefaultRequest request, ServerCallContext context)
|
||||||
|
{
|
||||||
|
return await _dispatchRequestToCQRS.Handle<SetAddressAsDefaultRequest, SetAddressAsDefaultCommand>(request, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.0.114</Version>
|
<Version>0.0.115</Version>
|
||||||
<DebugType>None</DebugType>
|
<DebugType>None</DebugType>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ message UpdateUserRequest
|
|||||||
google.protobuf.StringValue national_code = 4;
|
google.protobuf.StringValue national_code = 4;
|
||||||
google.protobuf.StringValue avatar_path = 5;
|
google.protobuf.StringValue avatar_path = 5;
|
||||||
UserAvatarFileModel avatar_file = 6;
|
UserAvatarFileModel avatar_file = 6;
|
||||||
|
bool email_notifications = 7;
|
||||||
|
bool sms_notifications = 8;
|
||||||
|
bool push_notifications = 9;
|
||||||
|
google.protobuf.Timestamp birth_date = 10;
|
||||||
}
|
}
|
||||||
message UserAvatarFileModel
|
message UserAvatarFileModel
|
||||||
{
|
{
|
||||||
@@ -81,6 +85,10 @@ message GetUserResponse
|
|||||||
string referral_code = 9;
|
string referral_code = 9;
|
||||||
bool is_mobile_verified = 10;
|
bool is_mobile_verified = 10;
|
||||||
google.protobuf.Timestamp mobile_verified_at = 11;
|
google.protobuf.Timestamp mobile_verified_at = 11;
|
||||||
|
bool email_notifications = 12;
|
||||||
|
bool sms_notifications = 13;
|
||||||
|
bool push_notifications = 14;
|
||||||
|
google.protobuf.Timestamp birth_date = 15;
|
||||||
}
|
}
|
||||||
message GetAllUserByFilterRequest
|
message GetAllUserByFilterRequest
|
||||||
{
|
{
|
||||||
@@ -99,6 +107,10 @@ message GetAllUserByFilterFilter
|
|||||||
google.protobuf.Int64Value parent_id = 7;
|
google.protobuf.Int64Value parent_id = 7;
|
||||||
google.protobuf.StringValue referral_code = 8;
|
google.protobuf.StringValue referral_code = 8;
|
||||||
google.protobuf.BoolValue is_mobile_verified = 9;
|
google.protobuf.BoolValue is_mobile_verified = 9;
|
||||||
|
google.protobuf.BoolValue email_notifications = 10;
|
||||||
|
google.protobuf.BoolValue sms_notifications = 11;
|
||||||
|
google.protobuf.BoolValue push_notifications = 12;
|
||||||
|
google.protobuf.Timestamp birth_date = 13;
|
||||||
}
|
}
|
||||||
message GetAllUserByFilterResponse
|
message GetAllUserByFilterResponse
|
||||||
{
|
{
|
||||||
@@ -117,6 +129,10 @@ message GetAllUserByFilterResponseModel
|
|||||||
string referral_code = 8;
|
string referral_code = 8;
|
||||||
bool is_mobile_verified = 9;
|
bool is_mobile_verified = 9;
|
||||||
google.protobuf.Timestamp mobile_verified_at = 10;
|
google.protobuf.Timestamp mobile_verified_at = 10;
|
||||||
|
bool email_notifications = 11;
|
||||||
|
bool sms_notifications = 12;
|
||||||
|
bool push_notifications = 13;
|
||||||
|
google.protobuf.Timestamp birth_date = 14;
|
||||||
}
|
}
|
||||||
message CreateNewOtpTokenRequest
|
message CreateNewOtpTokenRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ public class UpdateUserRequestValidator : AbstractValidator<UpdateUserRequest>
|
|||||||
{
|
{
|
||||||
RuleFor(model => model.Id)
|
RuleFor(model => model.Id)
|
||||||
.NotNull();
|
.NotNull();
|
||||||
|
RuleFor(model => model.EmailNotifications)
|
||||||
|
.NotNull();
|
||||||
|
RuleFor(model => model.SmsNotifications)
|
||||||
|
.NotNull();
|
||||||
|
RuleFor(model => model.PushNotifications)
|
||||||
|
.NotNull();
|
||||||
}
|
}
|
||||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.0.113</Version>
|
<Version>0.0.114</Version>
|
||||||
<DebugType>None</DebugType>
|
<DebugType>None</DebugType>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ service UserAddressContract
|
|||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
rpc SetAddressAsDefault(SetAddressAsDefaultRequest) returns (google.protobuf.Empty){
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/SetAddressAsDefault"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
message CreateNewUserAddressRequest
|
message CreateNewUserAddressRequest
|
||||||
{
|
{
|
||||||
@@ -113,6 +119,10 @@ message GetAllUserAddressByFilterResponseModel
|
|||||||
bool is_default = 6;
|
bool is_default = 6;
|
||||||
int64 city_id = 7;
|
int64 city_id = 7;
|
||||||
}
|
}
|
||||||
|
message SetAddressAsDefaultRequest
|
||||||
|
{
|
||||||
|
int64 id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message PaginationState
|
message PaginationState
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using FrontOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||||
|
namespace FrontOffice.BFF.UserAddress.Protobuf.Validator;
|
||||||
|
|
||||||
|
public class SetAddressAsDefaultRequestValidator : AbstractValidator<SetAddressAsDefaultRequest>
|
||||||
|
{
|
||||||
|
public SetAddressAsDefaultRequestValidator()
|
||||||
|
{
|
||||||
|
RuleFor(model => model.Id)
|
||||||
|
.NotNull();
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<SetAddressAsDefaultRequest>.CreateWithOptions((SetAddressAsDefaultRequest)model, x => x.IncludeProperties(propertyName)));
|
||||||
|
if (result.IsValid)
|
||||||
|
return Array.Empty<string>();
|
||||||
|
return result.Errors.Select(e => e.ErrorMessage);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -51,6 +51,7 @@ message CreateNewUserOrderRequest
|
|||||||
bool payment_status = 4;
|
bool payment_status = 4;
|
||||||
google.protobuf.Timestamp payment_date = 5;
|
google.protobuf.Timestamp payment_date = 5;
|
||||||
int64 user_id = 6;
|
int64 user_id = 6;
|
||||||
|
int64 user_address_id = 7;
|
||||||
}
|
}
|
||||||
message CreateNewUserOrderResponse
|
message CreateNewUserOrderResponse
|
||||||
{
|
{
|
||||||
@@ -83,6 +84,7 @@ message GetUserOrderResponse
|
|||||||
bool payment_status = 5;
|
bool payment_status = 5;
|
||||||
google.protobuf.Timestamp payment_date = 6;
|
google.protobuf.Timestamp payment_date = 6;
|
||||||
int64 user_id = 7;
|
int64 user_id = 7;
|
||||||
|
int64 user_address_id = 8;
|
||||||
}
|
}
|
||||||
message GetAllUserOrderByFilterRequest
|
message GetAllUserOrderByFilterRequest
|
||||||
{
|
{
|
||||||
@@ -99,6 +101,7 @@ message GetAllUserOrderByFilterFilter
|
|||||||
google.protobuf.BoolValue payment_status = 5;
|
google.protobuf.BoolValue payment_status = 5;
|
||||||
google.protobuf.Timestamp payment_date = 6;
|
google.protobuf.Timestamp payment_date = 6;
|
||||||
google.protobuf.Int64Value user_id = 7;
|
google.protobuf.Int64Value user_id = 7;
|
||||||
|
google.protobuf.Int64Value user_address_id = 8;
|
||||||
}
|
}
|
||||||
message GetAllUserOrderByFilterResponse
|
message GetAllUserOrderByFilterResponse
|
||||||
{
|
{
|
||||||
@@ -114,6 +117,7 @@ message GetAllUserOrderByFilterResponseModel
|
|||||||
bool payment_status = 5;
|
bool payment_status = 5;
|
||||||
google.protobuf.Timestamp payment_date = 6;
|
google.protobuf.Timestamp payment_date = 6;
|
||||||
int64 user_id = 7;
|
int64 user_id = 7;
|
||||||
|
int64 user_address_id = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PaginationState
|
message PaginationState
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class CreateNewUserOrderRequestValidator : AbstractValidator<CreateNewUse
|
|||||||
.NotNull();
|
.NotNull();
|
||||||
RuleFor(model => model.UserId)
|
RuleFor(model => model.UserId)
|
||||||
.NotNull();
|
.NotNull();
|
||||||
|
RuleFor(model => model.UserAddressId)
|
||||||
|
.NotNull();
|
||||||
}
|
}
|
||||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user