Generator Changes at 11/14/2025 3:36:13 PM +03:30
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.AcceptContract;
|
||||||
|
public record AcceptContractCommand : IRequest<Unit>
|
||||||
|
{
|
||||||
|
//کد otp
|
||||||
|
public string? Code { get; init; }
|
||||||
|
//فایل قرارداد
|
||||||
|
public string? ContractHtml { get; init; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.AcceptContract;
|
||||||
|
public class AcceptContractCommandHandler : IRequestHandler<AcceptContractCommand, Unit>
|
||||||
|
{
|
||||||
|
private readonly IApplicationContractContext _context;
|
||||||
|
|
||||||
|
public AcceptContractCommandHandler(IApplicationContractContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Unit> Handle(AcceptContractCommand request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
//TODO: Implement your business logic
|
||||||
|
return new Unit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.AcceptContract;
|
||||||
|
public class AcceptContractCommandValidator : AbstractValidator<AcceptContractCommand>
|
||||||
|
{
|
||||||
|
public AcceptContractCommandValidator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<AcceptContractCommand>.CreateWithOptions((AcceptContractCommand)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.CreateContractOtpToken;
|
||||||
|
public record CreateContractOtpTokenCommand : IRequest<Unit>
|
||||||
|
{
|
||||||
|
//شناسه یکتای قرارداد
|
||||||
|
public string? CotractGuid { get; init; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateContractOtpToken;
|
||||||
|
public class CreateContractOtpTokenCommandHandler : IRequestHandler<CreateContractOtpTokenCommand, Unit>
|
||||||
|
{
|
||||||
|
private readonly IApplicationContractContext _context;
|
||||||
|
|
||||||
|
public CreateContractOtpTokenCommandHandler(IApplicationContractContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Unit> Handle(CreateContractOtpTokenCommand request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
//TODO: Implement your business logic
|
||||||
|
return new Unit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.CreateContractOtpToken;
|
||||||
|
public class CreateContractOtpTokenCommandValidator : AbstractValidator<CreateContractOtpTokenCommand>
|
||||||
|
{
|
||||||
|
public CreateContractOtpTokenCommandValidator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<CreateContractOtpTokenCommand>.CreateWithOptions((CreateContractOtpTokenCommand)model, x => x.IncludeProperties(propertyName)));
|
||||||
|
if (result.IsValid)
|
||||||
|
return Array.Empty<string>();
|
||||||
|
return result.Errors.Select(e => e.ErrorMessage);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using FrontOffice.BFF.Protobuf.Protos.User;
|
||||||
using FrontOffice.BFF.WebApi.Common.Services;
|
using FrontOffice.BFF.WebApi.Common.Services;
|
||||||
using FrontOffice.BFF.Application.UserCQ.Commands.UpdateUser;
|
using FrontOffice.BFF.Application.UserCQ.Commands.UpdateUser;
|
||||||
using FrontOffice.BFF.Application.UserCQ.Commands.DeleteUser;
|
using FrontOffice.BFF.Application.UserCQ.Commands.DeleteUser;
|
||||||
@@ -54,4 +55,11 @@ public class UserService : UserContract.UserContractBase
|
|||||||
{
|
{
|
||||||
return await _dispatchRequestToCQRS.Handle<SetPasswordForUserRequest, SetPasswordForUserCommand>(request, context);
|
return await _dispatchRequestToCQRS.Handle<SetPasswordForUserRequest, SetPasswordForUserCommand>(request, context);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
return await _dispatchRequestToCQRS.Handle<CreateContractOtpTokenRequest, CreateContractOtpTokenCommand>(request, context);
|
||||||
|
}
|
||||||
|
public override async Task<Empty> AcceptContract(AcceptContractRequest request, ServerCallContext context)
|
||||||
|
{
|
||||||
|
return await _dispatchRequestToCQRS.Handle<AcceptContractRequest, AcceptContractCommand>(request, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,18 @@ service UserContract
|
|||||||
body: "*"
|
body: "*"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
rpc CreateContractOtpToken(CreateContractOtpTokenRequest) returns (google.protobuf.Empty){
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/CreateContractOtpToken"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
rpc AcceptContract(AcceptContractRequest) returns (google.protobuf.Empty){
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/AcceptContract"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
message UpdateUserRequest
|
message UpdateUserRequest
|
||||||
{
|
{
|
||||||
@@ -188,6 +200,15 @@ message SetPasswordForUserRequest
|
|||||||
string new_password = 2;
|
string new_password = 2;
|
||||||
string confirm_password = 3;
|
string confirm_password = 3;
|
||||||
}
|
}
|
||||||
|
message CreateContractOtpTokenRequest
|
||||||
|
{
|
||||||
|
google.protobuf.StringValue cotract_guid = 1;
|
||||||
|
}
|
||||||
|
message AcceptContractRequest
|
||||||
|
{
|
||||||
|
google.protobuf.StringValue code = 1;
|
||||||
|
google.protobuf.StringValue contract_html = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message PaginationState
|
message PaginationState
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using FrontOfficeMicroservice.Protobuf.Protos.User;
|
||||||
|
namespace FrontOfficeMicroservice.Protobuf.Validator.User;
|
||||||
|
|
||||||
|
public class AcceptContractRequestValidator : AbstractValidator<AcceptContractRequest>
|
||||||
|
{
|
||||||
|
public AcceptContractRequestValidator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<AcceptContractRequest>.CreateWithOptions((AcceptContractRequest)model, x => x.IncludeProperties(propertyName)));
|
||||||
|
if (result.IsValid)
|
||||||
|
return Array.Empty<string>();
|
||||||
|
return result.Errors.Select(e => e.ErrorMessage);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using FrontOfficeMicroservice.Protobuf.Protos.User;
|
||||||
|
namespace FrontOfficeMicroservice.Protobuf.Validator.User;
|
||||||
|
|
||||||
|
public class CreateContractOtpTokenRequestValidator : AbstractValidator<CreateContractOtpTokenRequest>
|
||||||
|
{
|
||||||
|
public CreateContractOtpTokenRequestValidator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||||
|
{
|
||||||
|
var result = await ValidateAsync(ValidationContext<CreateContractOtpTokenRequest>.CreateWithOptions((CreateContractOtpTokenRequest)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