Generator Changes at 9/27/2025 10:36:00 AM
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
||||
public record GetAllPackageByFilterQuery : IRequest<GetAllPackageByFilterResponseDto>
|
||||
{
|
||||
//موقعیت صفحه بندی
|
||||
public PaginationState? PaginationState { get; init; }
|
||||
//مرتب سازی بر اساس
|
||||
public string? SortBy { get; init; }
|
||||
//فیلتر
|
||||
public GetAllPackageByFilterFilter? Filter { get; init; }
|
||||
|
||||
}public class GetAllPackageByFilterFilter
|
||||
{
|
||||
//شناسه
|
||||
public long? Id { get; set; }
|
||||
//عنوان
|
||||
public string? Title { get; set; }
|
||||
//توضیحات
|
||||
public string? Description { get; set; }
|
||||
//آدرس تصویر
|
||||
public string? ImagePath { get; set; }
|
||||
//قیمت
|
||||
public long? Price { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
||||
public class GetAllPackageByFilterQueryHandler : IRequestHandler<GetAllPackageByFilterQuery, GetAllPackageByFilterResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetAllPackageByFilterQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetAllPackageByFilterResponseDto> Handle(GetAllPackageByFilterQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetAllPackageByFilterResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
||||
public class GetAllPackageByFilterQueryValidator : AbstractValidator<GetAllPackageByFilterQuery>
|
||||
{
|
||||
public GetAllPackageByFilterQueryValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllPackageByFilterQuery>.CreateWithOptions((GetAllPackageByFilterQuery)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
||||
public class GetAllPackageByFilterResponseDto
|
||||
{
|
||||
//متادیتا
|
||||
public MetaData MetaData { get; set; }
|
||||
//مدل خروجی
|
||||
public List<GetAllPackageByFilterResponseModel>? Models { get; set; }
|
||||
|
||||
}public class GetAllPackageByFilterResponseModel
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//عنوان
|
||||
public string Title { get; set; }
|
||||
//توضیحات
|
||||
public string Description { get; set; }
|
||||
//آدرس تصویر
|
||||
public string ImagePath { get; set; }
|
||||
//قیمت
|
||||
public long Price { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetPackage;
|
||||
public record GetPackageQuery : IRequest<GetPackageResponseDto>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetPackage;
|
||||
public class GetPackageQueryHandler : IRequestHandler<GetPackageQuery, GetPackageResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetPackageQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetPackageResponseDto> Handle(GetPackageQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetPackageResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetPackage;
|
||||
public class GetPackageQueryValidator : AbstractValidator<GetPackageQuery>
|
||||
{
|
||||
public GetPackageQueryValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetPackageQuery>.CreateWithOptions((GetPackageQuery)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetPackage;
|
||||
public class GetPackageResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//عنوان
|
||||
public string Title { get; set; }
|
||||
//توضیحات
|
||||
public string Description { get; set; }
|
||||
//آدرس تصویر
|
||||
public string ImagePath { get; set; }
|
||||
//قیمت
|
||||
public long Price { get; set; }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user