Generator Changes at 9/27/2025 10:36:00 AM
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public record CreateNewUserRoleCommand : IRequest<CreateNewUserRoleResponseDto>
|
||||
{
|
||||
//شناسه نقش
|
||||
public long RoleId { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public class CreateNewUserRoleCommandHandler : IRequestHandler<CreateNewUserRoleCommand, CreateNewUserRoleResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public CreateNewUserRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<CreateNewUserRoleResponseDto> Handle(CreateNewUserRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewUserRoleResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public class CreateNewUserRoleCommandValidator : AbstractValidator<CreateNewUserRoleCommand>
|
||||
{
|
||||
public CreateNewUserRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.RoleId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserRoleCommand>.CreateWithOptions((CreateNewUserRoleCommand)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.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public class CreateNewUserRoleResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
|
||||
public record DeleteUserRoleCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
|
||||
public class DeleteUserRoleCommandHandler : IRequestHandler<DeleteUserRoleCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public DeleteUserRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(DeleteUserRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
|
||||
public class DeleteUserRoleCommandValidator : AbstractValidator<DeleteUserRoleCommand>
|
||||
{
|
||||
public DeleteUserRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserRoleCommand>.CreateWithOptions((DeleteUserRoleCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole;
|
||||
public record UpdateUserRoleCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
//شناسه نقش
|
||||
public long RoleId { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole;
|
||||
public class UpdateUserRoleCommandHandler : IRequestHandler<UpdateUserRoleCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public UpdateUserRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(UpdateUserRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole;
|
||||
public class UpdateUserRoleCommandValidator : AbstractValidator<UpdateUserRoleCommand>
|
||||
{
|
||||
public UpdateUserRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.RoleId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserRoleCommand>.CreateWithOptions((UpdateUserRoleCommand)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