Generator Changes at 10/13/2025 8:22:12 AM

This commit is contained in:
MeysamMoghaddam
2025-10-13 08:25:31 +03:30
parent d5451e4d7e
commit 05f4833270
23 changed files with 154 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
namespace FrontOffice.BFF.Application.UserAddressCQ.Commands.SetAddressAsDefault;
public record SetAddressAsDefaultCommand : IRequest<Unit>
{
//شناسه
public long Id { get; init; }
}

View File

@@ -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;
}
}

View File

@@ -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);
};
}

View File

@@ -13,6 +13,14 @@ public record UpdateUserCommand : IRequest<Unit>
public string? AvatarPath { 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
{

View File

@@ -5,6 +5,12 @@ public class UpdateUserCommandValidator : AbstractValidator<UpdateUserCommand>
{
RuleFor(model => model.Id)
.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) =>
{

View File

@@ -28,4 +28,12 @@ public record GetAllUserByFilterQuery : IRequest<GetAllUserByFilterResponseDto>
public string? ReferralCode { 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; }
}

View File

@@ -28,4 +28,12 @@ public class GetAllUserByFilterResponseDto
public bool IsMobileVerified { 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; }
}

View File

@@ -23,5 +23,13 @@ public class GetUserResponseDto
public bool IsMobileVerified { 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; }
}

View File

@@ -13,5 +13,7 @@ public record CreateNewUserOrderCommand : IRequest<CreateNewUserOrderResponseDto
public DateTime? PaymentDate { get; init; }
//شناسه کاربر
public long UserId { get; init; }
//شناسه آدرس کاربر
public long UserAddressId { get; init; }
}

View File

@@ -11,6 +11,8 @@ public class CreateNewUserOrderCommandValidator : AbstractValidator<CreateNewUse
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
RuleFor(model => model.UserAddressId)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{

View File

@@ -24,4 +24,6 @@ public record GetAllUserOrderByFilterQuery : IRequest<GetAllUserOrderByFilterRes
public DateTime? PaymentDate { get; set; }
//شناسه کاربر
public long? UserId { get; set; }
//شناسه آدرس کاربر
public long? UserAddressId { get; set; }
}

View File

@@ -22,4 +22,6 @@ public class GetAllUserOrderByFilterResponseDto
public DateTime? PaymentDate { get; set; }
//شناسه کاربر
public long UserId { get; set; }
//شناسه آدرس کاربر
public long UserAddressId { get; set; }
}

View File

@@ -15,5 +15,7 @@ public class GetUserOrderResponseDto
public DateTime? PaymentDate { get; set; }
//شناسه کاربر
public long UserId { get; set; }
//شناسه آدرس کاربر
public long UserAddressId { get; set; }
}