This commit is contained in:
King
2025-09-28 15:24:13 +03:30
parent 514b3a5975
commit 4241523443
222 changed files with 8139 additions and 0 deletions
@@ -0,0 +1,19 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
public record GetAllUserRoleByFilterQuery : IRequest<GetAllUserRoleByFilterResponseDto>
{
//موقعیت صفحه بندی
public PaginationState? PaginationState { get; init; }
//مرتب سازی بر اساس
public string? SortBy { get; init; }
//فیلتر
public GetAllUserRoleByFilterFilter? Filter { get; init; }
}public class GetAllUserRoleByFilterFilter
{
//شناسه
public long? Id { get; set; }
//شناسه نقش
public long? RoleId { get; set; }
//شناسه کاربر
public long? UserId { get; set; }
}
@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
public class GetAllUserRoleByFilterQueryHandler : IRequestHandler<GetAllUserRoleByFilterQuery, GetAllUserRoleByFilterResponseDto>
{
private readonly IApplicationContractContext _context;
public GetAllUserRoleByFilterQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetAllUserRoleByFilterResponseDto> Handle(GetAllUserRoleByFilterQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetAllUserRoleByFilterResponseDto();
}
}
@@ -0,0 +1,14 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
public class GetAllUserRoleByFilterQueryValidator : AbstractValidator<GetAllUserRoleByFilterQuery>
{
public GetAllUserRoleByFilterQueryValidator()
{
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetAllUserRoleByFilterQuery>.CreateWithOptions((GetAllUserRoleByFilterQuery)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,17 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
public class GetAllUserRoleByFilterResponseDto
{
//متادیتا
public MetaData MetaData { get; set; }
//مدل خروجی
public List<GetAllUserRoleByFilterResponseModel>? Models { get; set; }
}public class GetAllUserRoleByFilterResponseModel
{
//شناسه
public long Id { get; set; }
//شناسه نقش
public long RoleId { get; set; }
//شناسه کاربر
public long UserId { get; set; }
}
@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
public record GetUserRoleQuery : IRequest<GetUserRoleResponseDto>
{
//شناسه
public long Id { get; init; }
}
@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
public class GetUserRoleQueryHandler : IRequestHandler<GetUserRoleQuery, GetUserRoleResponseDto>
{
private readonly IApplicationContractContext _context;
public GetUserRoleQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetUserRoleResponseDto> Handle(GetUserRoleQuery request, CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new GetUserRoleResponseDto();
}
}
@@ -0,0 +1,16 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
public class GetUserRoleQueryValidator : AbstractValidator<GetUserRoleQuery>
{
public GetUserRoleQueryValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetUserRoleQuery>.CreateWithOptions((GetUserRoleQuery)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,11 @@
namespace BackOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
public class GetUserRoleResponseDto
{
//شناسه
public long Id { get; set; }
//شناسه نقش
public long RoleId { get; set; }
//شناسه کاربر
public long UserId { get; set; }
}