Generator Changes at 9/27/2025 10:36:00 AM
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
||||
public record CreateNewUserCommand : IRequest<CreateNewUserResponseDto>
|
||||
{
|
||||
//نام
|
||||
public string? FirstName { get; init; }
|
||||
//نام خانوادگی
|
||||
public string? LastName { get; init; }
|
||||
//شماره موبایل
|
||||
public string Mobile { get; init; }
|
||||
//کد ملی
|
||||
public string? NationalCode { get; init; }
|
||||
//آدرس آواتار
|
||||
public string? AvatarPath { get; init; }
|
||||
//شناسه والد
|
||||
public long? ParentId { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
||||
public class CreateNewUserCommandHandler : IRequestHandler<CreateNewUserCommand, CreateNewUserResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public CreateNewUserCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<CreateNewUserResponseDto> Handle(CreateNewUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewUserResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
||||
public class CreateNewUserCommandValidator : AbstractValidator<CreateNewUserCommand>
|
||||
{
|
||||
public CreateNewUserCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Mobile)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserCommand>.CreateWithOptions((CreateNewUserCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
||||
public class CreateNewUserResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.DeleteUser;
|
||||
public record DeleteUserCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.DeleteUser;
|
||||
public class DeleteUserCommandHandler : IRequestHandler<DeleteUserCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public DeleteUserCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(DeleteUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.DeleteUser;
|
||||
public class DeleteUserCommandValidator : AbstractValidator<DeleteUserCommand>
|
||||
{
|
||||
public DeleteUserCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserCommand>.CreateWithOptions((DeleteUserCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.UpdateUser;
|
||||
public record UpdateUserCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
//نام
|
||||
public string? FirstName { get; init; }
|
||||
//نام خانوادگی
|
||||
public string? LastName { get; init; }
|
||||
//شماره موبایل
|
||||
public string Mobile { get; init; }
|
||||
//کد ملی
|
||||
public string? NationalCode { get; init; }
|
||||
//آدرس آواتار
|
||||
public string? AvatarPath { get; init; }
|
||||
//شناسه والد
|
||||
public long? ParentId { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.UpdateUser;
|
||||
public class UpdateUserCommandHandler : IRequestHandler<UpdateUserCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public UpdateUserCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(UpdateUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.UpdateUser;
|
||||
public class UpdateUserCommandValidator : AbstractValidator<UpdateUserCommand>
|
||||
{
|
||||
public UpdateUserCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Mobile)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserCommand>.CreateWithOptions((UpdateUserCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user