u
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
using CMSMicroservice.Protobuf.Protos.OtpToken;
|
||||
using CMSMicroservice.Protobuf.Protos.Package;
|
||||
using CMSMicroservice.Protobuf.Protos.User;
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||
|
||||
namespace FrontOffice.BFF.Application.Common.Interfaces;
|
||||
|
||||
public interface IApplicationContractContext
|
||||
@@ -7,4 +13,12 @@ public interface IApplicationContractContext
|
||||
//FileLogContract.FileLogContractClient FileManagements { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region CMS
|
||||
PackageContract.PackageContractClient Package { get; }
|
||||
UserContract.UserContractClient User { get; }
|
||||
UserAddressContract.UserAddressContractClient UserAddress { get; }
|
||||
UserOrderContract.UserOrderContractClient UserOrder { get; }
|
||||
OtpTokenContract.OtpTokenContractClient OtpToken { get; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace FrontOffice.BFF.Application.Common.Interfaces;
|
||||
public interface IKavenegarService
|
||||
{
|
||||
Task Send(string mobile, string message);
|
||||
Task VerifyLookup(string mobile, string token);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
|
||||
public record CreateNewPackageCommand : IRequest<CreateNewPackageResponseDto>
|
||||
{
|
||||
//عنوان
|
||||
public string Title { get; init; }
|
||||
//توضیحات
|
||||
public string Description { get; init; }
|
||||
//آدرس تصویر
|
||||
public string ImagePath { get; init; }
|
||||
//قیمت
|
||||
public long Price { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
|
||||
public class CreateNewPackageCommandHandler : IRequestHandler<CreateNewPackageCommand, CreateNewPackageResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public CreateNewPackageCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<CreateNewPackageResponseDto> Handle(CreateNewPackageCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewPackageResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
|
||||
public class CreateNewPackageCommandValidator : AbstractValidator<CreateNewPackageCommand>
|
||||
{
|
||||
public CreateNewPackageCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ImagePath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Price)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewPackageCommand>.CreateWithOptions((CreateNewPackageCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.CreateNewPackage;
|
||||
public class CreateNewPackageResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
|
||||
public record DeletePackageCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
|
||||
public class DeletePackageCommandHandler : IRequestHandler<DeletePackageCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public DeletePackageCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(DeletePackageCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.DeletePackage;
|
||||
public class DeletePackageCommandValidator : AbstractValidator<DeletePackageCommand>
|
||||
{
|
||||
public DeletePackageCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeletePackageCommand>.CreateWithOptions((DeletePackageCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
|
||||
public record UpdatePackageCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
//عنوان
|
||||
public string Title { get; init; }
|
||||
//توضیحات
|
||||
public string Description { get; init; }
|
||||
//آدرس تصویر
|
||||
public string ImagePath { get; init; }
|
||||
//قیمت
|
||||
public long Price { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
|
||||
public class UpdatePackageCommandHandler : IRequestHandler<UpdatePackageCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public UpdatePackageCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(UpdatePackageCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Commands.UpdatePackage;
|
||||
public class UpdatePackageCommandValidator : AbstractValidator<UpdatePackageCommand>
|
||||
{
|
||||
public UpdatePackageCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Description)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.ImagePath)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Price)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdatePackageCommand>.CreateWithOptions((UpdatePackageCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using CMSMicroservice.Protobuf.Protos.Package;
|
||||
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
||||
public class GetAllPackageByFilterQueryHandler : IRequestHandler<GetAllPackageByFilterQuery, GetAllPackageByFilterResponseDto>
|
||||
{
|
||||
@@ -10,7 +12,7 @@ public class GetAllPackageByFilterQueryHandler : IRequestHandler<GetAllPackageBy
|
||||
|
||||
public async Task<GetAllPackageByFilterResponseDto> Handle(GetAllPackageByFilterQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetAllPackageByFilterResponseDto();
|
||||
var response = await _context.Package.GetAllPackageByFilterAsync(request: request.Adapt<GetAllPackageByFilterRequest>(), cancellationToken: cancellationToken);
|
||||
return response.Adapt<GetAllPackageByFilterResponseDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using CMSMicroservice.Protobuf.Protos.Package;
|
||||
|
||||
namespace FrontOffice.BFF.Application.PackageCQ.Queries.GetPackage;
|
||||
public class GetPackageQueryHandler : IRequestHandler<GetPackageQuery, GetPackageResponseDto>
|
||||
{
|
||||
@@ -10,7 +12,7 @@ public class GetPackageQueryHandler : IRequestHandler<GetPackageQuery, GetPackag
|
||||
|
||||
public async Task<GetPackageResponseDto> Handle(GetPackageQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetPackageResponseDto();
|
||||
var response = await _context.Package.GetPackageAsync(request: request.Adapt<GetPackageRequest>(), cancellationToken: cancellationToken);
|
||||
return response.Adapt<GetPackageResponseDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.CreateNewRole;
|
||||
public record CreateNewRoleCommand : IRequest<CreateNewRoleResponseDto>
|
||||
{
|
||||
//نام لاتین
|
||||
public string Name { get; init; }
|
||||
//عنوان
|
||||
public string Title { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.CreateNewRole;
|
||||
public class CreateNewRoleCommandHandler : IRequestHandler<CreateNewRoleCommand, CreateNewRoleResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public CreateNewRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<CreateNewRoleResponseDto> Handle(CreateNewRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewRoleResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.CreateNewRole;
|
||||
public class CreateNewRoleCommandValidator : AbstractValidator<CreateNewRoleCommand>
|
||||
{
|
||||
public CreateNewRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Name)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewRoleCommand>.CreateWithOptions((CreateNewRoleCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.CreateNewRole;
|
||||
public class CreateNewRoleResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.DeleteRole;
|
||||
public record DeleteRoleCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.DeleteRole;
|
||||
public class DeleteRoleCommandHandler : IRequestHandler<DeleteRoleCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public DeleteRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(DeleteRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.DeleteRole;
|
||||
public class DeleteRoleCommandValidator : AbstractValidator<DeleteRoleCommand>
|
||||
{
|
||||
public DeleteRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteRoleCommand>.CreateWithOptions((DeleteRoleCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.UpdateRole;
|
||||
public record UpdateRoleCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
//نام لاتین
|
||||
public string Name { get; init; }
|
||||
//عنوان
|
||||
public string Title { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.UpdateRole;
|
||||
public class UpdateRoleCommandHandler : IRequestHandler<UpdateRoleCommand, Unit>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public UpdateRoleCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<Unit> Handle(UpdateRoleCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new Unit();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Commands.UpdateRole;
|
||||
public class UpdateRoleCommandValidator : AbstractValidator<UpdateRoleCommand>
|
||||
{
|
||||
public UpdateRoleCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Name)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateRoleCommand>.CreateWithOptions((UpdateRoleCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter;
|
||||
public record GetAllRoleByFilterQuery : IRequest<GetAllRoleByFilterResponseDto>
|
||||
{
|
||||
//موقعیت صفحه بندی
|
||||
public PaginationState? PaginationState { get; init; }
|
||||
//مرتب سازی بر اساس
|
||||
public string? SortBy { get; init; }
|
||||
//فیلتر
|
||||
public GetAllRoleByFilterFilter? Filter { get; init; }
|
||||
|
||||
}public class GetAllRoleByFilterFilter
|
||||
{
|
||||
//شناسه
|
||||
public long? Id { get; set; }
|
||||
//نام لاتین
|
||||
public string? Name { get; set; }
|
||||
//عنوان
|
||||
public string? Title { get; set; }
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter;
|
||||
public class GetAllRoleByFilterQueryHandler : IRequestHandler<GetAllRoleByFilterQuery, GetAllRoleByFilterResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetAllRoleByFilterQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetAllRoleByFilterResponseDto> Handle(GetAllRoleByFilterQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetAllRoleByFilterResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter;
|
||||
public class GetAllRoleByFilterQueryValidator : AbstractValidator<GetAllRoleByFilterQuery>
|
||||
{
|
||||
public GetAllRoleByFilterQueryValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllRoleByFilterQuery>.CreateWithOptions((GetAllRoleByFilterQuery)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter;
|
||||
public class GetAllRoleByFilterResponseDto
|
||||
{
|
||||
//متادیتا
|
||||
public MetaData MetaData { get; set; }
|
||||
//مدل خروجی
|
||||
public List<GetAllRoleByFilterResponseModel>? Models { get; set; }
|
||||
|
||||
}public class GetAllRoleByFilterResponseModel
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//نام لاتین
|
||||
public string Name { get; set; }
|
||||
//عنوان
|
||||
public string Title { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetRole;
|
||||
public record GetRoleQuery : IRequest<GetRoleResponseDto>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetRole;
|
||||
public class GetRoleQueryHandler : IRequestHandler<GetRoleQuery, GetRoleResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetRoleQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetRoleResponseDto> Handle(GetRoleQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new GetRoleResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetRole;
|
||||
public class GetRoleQueryValidator : AbstractValidator<GetRoleQuery>
|
||||
{
|
||||
public GetRoleQueryValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetRoleQuery>.CreateWithOptions((GetRoleQuery)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.RoleCQ.Queries.GetRole;
|
||||
public class GetRoleResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//نام لاتین
|
||||
public string Name { get; set; }
|
||||
//عنوان
|
||||
public string Title { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,16 +1,22 @@
|
||||
using CMSMicroservice.Protobuf.Protos.OtpToken;
|
||||
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewOtpToken;
|
||||
public class CreateNewOtpTokenCommandHandler : IRequestHandler<CreateNewOtpTokenCommand, CreateNewOtpTokenResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
private readonly IKavenegarService _kavenegarService;
|
||||
|
||||
public CreateNewOtpTokenCommandHandler(IApplicationContractContext context)
|
||||
public CreateNewOtpTokenCommandHandler(IApplicationContractContext context, IKavenegarService kavenegarService)
|
||||
{
|
||||
_context = context;
|
||||
_kavenegarService = kavenegarService;
|
||||
}
|
||||
|
||||
public async Task<CreateNewOtpTokenResponseDto> Handle(CreateNewOtpTokenCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewOtpTokenResponseDto();
|
||||
var response = await _context.OtpToken.CreateNewOtpTokenAsync(request: request.Adapt<CreateNewOtpTokenRequest>(), cancellationToken: cancellationToken);
|
||||
if (response.Success && !string.IsNullOrWhiteSpace(response.Code))
|
||||
await _kavenegarService.VerifyLookup(mobile: request.Mobile, response.Code);
|
||||
return response.Adapt<CreateNewOtpTokenResponseDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
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; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
||||
public class CreateNewUserResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public record CreateNewUserRoleCommand : IRequest<CreateNewUserRoleResponseDto>
|
||||
{
|
||||
//شناسه نقش
|
||||
public long RoleId { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
public class CreateNewUserRoleResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
|
||||
public record DeleteUserRoleCommand : IRequest<Unit>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
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; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
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);
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace FrontOffice.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; }
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.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();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace FrontOffice.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);
|
||||
};
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace FrontOffice.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; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
|
||||
public record GetUserRoleQuery : IRequest<GetUserRoleResponseDto>
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; init; }
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.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();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace FrontOffice.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);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace FrontOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
|
||||
public class GetUserRoleResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
//شناسه نقش
|
||||
public long RoleId { get; set; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; set; }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user