u
This commit is contained in:
582
docs/model.ndm2
582
docs/model.ndm2
@@ -6337,312 +6337,6 @@
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectType": "Table_MSSQL",
|
||||
"name": "CreateNewOtpTokenResponse",
|
||||
"comment": "خروجی ایجاد توکن Otp جدید",
|
||||
"owner": "",
|
||||
"isChangeTracking": false,
|
||||
"isTrackColumnsUpdated": false,
|
||||
"oldName": "",
|
||||
"isSystemTable": false,
|
||||
"createTime": "",
|
||||
"modifyTime": "",
|
||||
"objectID": 8040,
|
||||
"numberOfRows": 0,
|
||||
"identityCurrent": 0,
|
||||
"dataLength": 0,
|
||||
"indexLength": 0,
|
||||
"fields": [
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Success",
|
||||
"type": "bit",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "موفق؟",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Success",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Message",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "پیام",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Message",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Code",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "Yes",
|
||||
"scale": -2147483648,
|
||||
"comment": "کد",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Code",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"primaryKey": {
|
||||
"objectType": "PrimaryKey_MSSQL",
|
||||
"name": "_copy_47",
|
||||
"fields": [],
|
||||
"fillFactor": 0,
|
||||
"oldName": "",
|
||||
"isClustered": false,
|
||||
"isPadded": false,
|
||||
"noRecomputeStatistics": false,
|
||||
"ignoreDuplicatedKeyValues": false,
|
||||
"allowRowLocks": false,
|
||||
"allowPageLocks": false,
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
"foreignKeys": [],
|
||||
"uniques": [],
|
||||
"checks": [],
|
||||
"triggers": [],
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectType": "Table_MSSQL",
|
||||
"name": "VerifyOtpTokenResponse",
|
||||
"comment": "خروجی فعالسازی توکن Otp",
|
||||
"owner": "",
|
||||
"isChangeTracking": false,
|
||||
"isTrackColumnsUpdated": false,
|
||||
"oldName": "",
|
||||
"isSystemTable": false,
|
||||
"createTime": "",
|
||||
"modifyTime": "",
|
||||
"objectID": 8040,
|
||||
"numberOfRows": 0,
|
||||
"identityCurrent": 0,
|
||||
"dataLength": 0,
|
||||
"indexLength": 0,
|
||||
"fields": [
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Success",
|
||||
"type": "bit",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "موفق؟",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Success",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Message",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "پیام",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Message",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "UserId",
|
||||
"type": "bigint",
|
||||
"size": -2147483648,
|
||||
"isNullable": "Yes",
|
||||
"scale": -2147483648,
|
||||
"comment": "شناسه کاربر",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "UserId",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"primaryKey": {
|
||||
"objectType": "PrimaryKey_MSSQL",
|
||||
"name": "_copy_47_copy_1",
|
||||
"fields": [],
|
||||
"fillFactor": 0,
|
||||
"oldName": "",
|
||||
"isClustered": false,
|
||||
"isPadded": false,
|
||||
"noRecomputeStatistics": false,
|
||||
"ignoreDuplicatedKeyValues": false,
|
||||
"allowRowLocks": false,
|
||||
"allowPageLocks": false,
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
"foreignKeys": [],
|
||||
"uniques": [],
|
||||
"checks": [],
|
||||
"triggers": [],
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectType": "Table_MSSQL",
|
||||
"name": "CreateNewOtpTokenRequest",
|
||||
@@ -8558,6 +8252,282 @@
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectType": "Table_MSSQL",
|
||||
"name": "CreateNewOtpTokenResponse",
|
||||
"comment": "خروجی ایجاد توکن Otp جدید",
|
||||
"owner": "",
|
||||
"isChangeTracking": false,
|
||||
"isTrackColumnsUpdated": false,
|
||||
"oldName": "",
|
||||
"isSystemTable": false,
|
||||
"createTime": "",
|
||||
"modifyTime": "",
|
||||
"objectID": 8040,
|
||||
"numberOfRows": 0,
|
||||
"identityCurrent": 0,
|
||||
"dataLength": 0,
|
||||
"indexLength": 0,
|
||||
"fields": [
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Success",
|
||||
"type": "bit",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "موفق؟",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Success",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Message",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "پیام",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Message",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"primaryKey": {
|
||||
"objectType": "PrimaryKey_MSSQL",
|
||||
"name": "_copy_47",
|
||||
"fields": [],
|
||||
"fillFactor": 0,
|
||||
"oldName": "",
|
||||
"isClustered": false,
|
||||
"isPadded": false,
|
||||
"noRecomputeStatistics": false,
|
||||
"ignoreDuplicatedKeyValues": false,
|
||||
"allowRowLocks": false,
|
||||
"allowPageLocks": false,
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
"foreignKeys": [],
|
||||
"uniques": [],
|
||||
"checks": [],
|
||||
"triggers": [],
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectType": "Table_MSSQL",
|
||||
"name": "VerifyOtpTokenResponse",
|
||||
"comment": "خروجی فعالسازی توکن Otp",
|
||||
"owner": "",
|
||||
"isChangeTracking": false,
|
||||
"isTrackColumnsUpdated": false,
|
||||
"oldName": "",
|
||||
"isSystemTable": false,
|
||||
"createTime": "",
|
||||
"modifyTime": "",
|
||||
"objectID": 8040,
|
||||
"numberOfRows": 0,
|
||||
"identityCurrent": 0,
|
||||
"dataLength": 0,
|
||||
"indexLength": 0,
|
||||
"fields": [
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Success",
|
||||
"type": "bit",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "موفق؟",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Success",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Message",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "No",
|
||||
"scale": -2147483648,
|
||||
"comment": "پیام",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Message",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
},
|
||||
{
|
||||
"objectType": "TableField_MSSQL",
|
||||
"name": "Token",
|
||||
"type": "nvarchar",
|
||||
"size": -2147483648,
|
||||
"isNullable": "Yes",
|
||||
"scale": -2147483648,
|
||||
"comment": "توکن",
|
||||
"computedExpression": "",
|
||||
"defaultValue": "",
|
||||
"defaultValueType": "Others",
|
||||
"schema": "",
|
||||
"userDefinedType": "",
|
||||
"collate": "",
|
||||
"isWithValues": false,
|
||||
"isFilestream": false,
|
||||
"isColumnSet": false,
|
||||
"isPersisted": false,
|
||||
"isSparse": false,
|
||||
"isRowGUIDColumn": false,
|
||||
"oldName": "Token",
|
||||
"computedBaseType": "",
|
||||
"isDefaultConstraint": false,
|
||||
"defaultConstraint": "",
|
||||
"isIdentity": false,
|
||||
"isExistingField": false,
|
||||
"identitySeed": 0,
|
||||
"identityIncrement": 0,
|
||||
"identityIsNotForReplication": false
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"primaryKey": {
|
||||
"objectType": "PrimaryKey_MSSQL",
|
||||
"name": "_copy_47_copy_1",
|
||||
"fields": [],
|
||||
"fillFactor": 0,
|
||||
"oldName": "",
|
||||
"isClustered": false,
|
||||
"isPadded": false,
|
||||
"noRecomputeStatistics": false,
|
||||
"ignoreDuplicatedKeyValues": false,
|
||||
"allowRowLocks": false,
|
||||
"allowPageLocks": false,
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
},
|
||||
"foreignKeys": [],
|
||||
"uniques": [],
|
||||
"checks": [],
|
||||
"triggers": [],
|
||||
"storage": {
|
||||
"objectType": "Storage_MSSQL",
|
||||
"name": "",
|
||||
"oldName": "",
|
||||
"storageType": "Default",
|
||||
"filegroup": "",
|
||||
"textImageFilegroup": "",
|
||||
"filestreamFilegroup": "",
|
||||
"partitionScheme": "",
|
||||
"partitionColumn": "",
|
||||
"filestreamPartitionScheme": "",
|
||||
"dataCompressions": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"views": []
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.111" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.114" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.55.1">
|
||||
|
||||
@@ -4,6 +4,7 @@ using FrontOffice.BFF.Infrastructure.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -12,6 +13,7 @@ public static class ConfigureServices
|
||||
public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddSingleton<IApplicationContractContext, ApplicationContractContext>();
|
||||
services.AddSingleton<IKavenegarService, KavenegarService>();
|
||||
services.AddInfrastructureGrpcServices(configuration);
|
||||
#region AddAuthentication
|
||||
|
||||
@@ -19,11 +21,24 @@ public static class ConfigureServices
|
||||
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(jwtBearerOptions =>
|
||||
{
|
||||
jwtBearerOptions.Authority = configuration["Authentication:Authority"];
|
||||
jwtBearerOptions.Audience = configuration["Authentication:Audience"];
|
||||
jwtBearerOptions.TokenValidationParameters.ValidateAudience = false;
|
||||
jwtBearerOptions.TokenValidationParameters.ValidateIssuer = true;
|
||||
jwtBearerOptions.TokenValidationParameters.ValidateIssuerSigningKey = false;
|
||||
//jwtBearerOptions.Authority = configuration["Authentication:Authority"];
|
||||
//jwtBearerOptions.Audience = configuration["Authentication:Audience"];
|
||||
//jwtBearerOptions.TokenValidationParameters.ValidateAudience = false;
|
||||
//jwtBearerOptions.TokenValidationParameters.ValidateIssuer = true;
|
||||
//jwtBearerOptions.TokenValidationParameters.ValidateIssuerSigningKey = false;
|
||||
|
||||
jwtBearerOptions.SaveToken = true;
|
||||
jwtBearerOptions.RequireHttpsMetadata = false;
|
||||
jwtBearerOptions.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = configuration["JwtIssuer"],
|
||||
ValidAudience = configuration["JwtAudience"],
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["JwtSecurityKey"]))
|
||||
};
|
||||
try
|
||||
{
|
||||
jwtBearerOptions.Events = new JwtBearerEvents
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
|
||||
<PackageReference Include="KavenegarDotNetCore" Version="1.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
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;
|
||||
using FrontOffice.BFF.Application.Common.Interfaces;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -7,7 +12,7 @@ public class ApplicationContractContext : IApplicationContractContext
|
||||
{
|
||||
#region members
|
||||
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -33,4 +38,15 @@ public class ApplicationContractContext : IApplicationContractContext
|
||||
|
||||
#endregion
|
||||
|
||||
#region CMS
|
||||
public PackageContract.PackageContractClient Package => GetService<PackageContract.PackageContractClient>();
|
||||
|
||||
public UserContract.UserContractClient User => GetService<UserContract.UserContractClient>();
|
||||
|
||||
public UserAddressContract.UserAddressContractClient UserAddress => GetService<UserAddressContract.UserAddressContractClient>();
|
||||
|
||||
public UserOrderContract.UserOrderContractClient UserOrder => GetService<UserOrderContract.UserOrderContractClient>();
|
||||
|
||||
public OtpTokenContract.OtpTokenContractClient OtpToken => GetService<OtpTokenContract.OtpTokenContractClient>();
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using FrontOffice.BFF.Application.Common.Interfaces;
|
||||
|
||||
namespace FrontOffice.BFF.Infrastructure.Services;
|
||||
public class KavenegarService : IKavenegarService
|
||||
{
|
||||
private Kavenegar.KavenegarApi _kavenegarApi;
|
||||
public KavenegarService()
|
||||
{
|
||||
_kavenegarApi = new Kavenegar.KavenegarApi("497263626F32626A48685A6137524C4F78575A766E4C74694A556B79317648424964655030682B554545413D");
|
||||
}
|
||||
public async Task Send(string mobile, string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _kavenegarApi.Send(sender: "1000001110100", receptor: mobile, message: message);
|
||||
}
|
||||
catch (Kavenegar.Core.Exceptions.ApiException ex)
|
||||
{
|
||||
// در صورتی که خروجی وب سرویس 200 نباشد این خطارخ می دهد.
|
||||
Console.Write("Message : " + ex.Message);
|
||||
}
|
||||
catch (Kavenegar.Core.Exceptions.HttpException ex)
|
||||
{
|
||||
// در زمانی که مشکلی در برقرای ارتباط با وب سرویس وجود داشته باشد این خطا رخ می دهد
|
||||
Console.Write("Message : " + ex.Message);
|
||||
}
|
||||
}
|
||||
public async Task VerifyLookup(string mobile, string token)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _kavenegarApi.VerifyLookup(receptor: mobile, token: token, template: "Afrino");
|
||||
}
|
||||
catch (Kavenegar.Core.Exceptions.ApiException ex)
|
||||
{
|
||||
// در صورتی که خروجی وب سرویس 200 نباشد این خطارخ می دهد.
|
||||
Console.Write("Message : " + ex.Message);
|
||||
}
|
||||
catch (Kavenegar.Core.Exceptions.HttpException ex)
|
||||
{
|
||||
// در زمانی که مشکلی در برقرای ارتباط با وب سرویس وجود داشته باشد این خطا رخ می دهد
|
||||
Console.Write("Message : " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,5 @@
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserAddress.Protobuf\FrontOffice.BFF.UserAddress.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Package.Protobuf\FrontOffice.BFF.Package.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Role.Protobuf\FrontOffice.BFF.Role.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserRole.Protobuf\FrontOffice.BFF.UserRole.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
using FrontOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using FrontOffice.BFF.WebApi.Common.Services;
|
||||
using FrontOffice.BFF.Application.RoleCQ.Commands.CreateNewRole;
|
||||
using FrontOffice.BFF.Application.RoleCQ.Commands.UpdateRole;
|
||||
using FrontOffice.BFF.Application.RoleCQ.Commands.DeleteRole;
|
||||
using FrontOffice.BFF.Application.RoleCQ.Queries.GetRole;
|
||||
using FrontOffice.BFF.Application.RoleCQ.Queries.GetAllRoleByFilter;
|
||||
namespace FrontOffice.BFF.WebApi.Services;
|
||||
public class RoleService : RoleContract.RoleContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public RoleService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
public override async Task<CreateNewRoleResponse> CreateNewRole(CreateNewRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<CreateNewRoleRequest, CreateNewRoleCommand, CreateNewRoleResponse>(request, context);
|
||||
}
|
||||
public override async Task<Empty> UpdateRole(UpdateRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<UpdateRoleRequest, UpdateRoleCommand>(request, context);
|
||||
}
|
||||
public override async Task<Empty> DeleteRole(DeleteRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<DeleteRoleRequest, DeleteRoleCommand>(request, context);
|
||||
}
|
||||
public override async Task<GetRoleResponse> GetRole(GetRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetRoleRequest, GetRoleQuery, GetRoleResponse>(request, context);
|
||||
}
|
||||
public override async Task<GetAllRoleByFilterResponse> GetAllRoleByFilter(GetAllRoleByFilterRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetAllRoleByFilterRequest, GetAllRoleByFilterQuery, GetAllRoleByFilterResponse>(request, context);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using FrontOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using FrontOffice.BFF.WebApi.Common.Services;
|
||||
using FrontOffice.BFF.Application.UserRoleCQ.Commands.CreateNewUserRole;
|
||||
using FrontOffice.BFF.Application.UserRoleCQ.Commands.UpdateUserRole;
|
||||
using FrontOffice.BFF.Application.UserRoleCQ.Commands.DeleteUserRole;
|
||||
using FrontOffice.BFF.Application.UserRoleCQ.Queries.GetUserRole;
|
||||
using FrontOffice.BFF.Application.UserRoleCQ.Queries.GetAllUserRoleByFilter;
|
||||
namespace FrontOffice.BFF.WebApi.Services;
|
||||
public class UserRoleService : UserRoleContract.UserRoleContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public UserRoleService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
public override async Task<CreateNewUserRoleResponse> CreateNewUserRole(CreateNewUserRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<CreateNewUserRoleRequest, CreateNewUserRoleCommand, CreateNewUserRoleResponse>(request, context);
|
||||
}
|
||||
public override async Task<Empty> UpdateUserRole(UpdateUserRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<UpdateUserRoleRequest, UpdateUserRoleCommand>(request, context);
|
||||
}
|
||||
public override async Task<Empty> DeleteUserRole(DeleteUserRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<DeleteUserRoleRequest, DeleteUserRoleCommand>(request, context);
|
||||
}
|
||||
public override async Task<GetUserRoleResponse> GetUserRole(GetUserRoleRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetUserRoleRequest, GetUserRoleQuery, GetUserRoleResponse>(request, context);
|
||||
}
|
||||
public override async Task<GetAllUserRoleByFilterResponse> GetAllUserRoleByFilter(GetAllUserRoleByFilterRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetAllUserRoleByFilterRequest, GetAllUserRoleByFilterQuery, GetAllUserRoleByFilterResponse>(request, context);
|
||||
}
|
||||
}
|
||||
@@ -14,16 +14,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Protobufs", "Protobufs", "{
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.Package.Protobuf", "Protobufs\FrontOffice.BFF.Package.Protobuf\FrontOffice.BFF.Package.Protobuf.csproj", "{F4E98BE4-6F95-4B4E-924D-CBAD02AF24F1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.Role.Protobuf", "Protobufs\FrontOffice.BFF.Role.Protobuf\FrontOffice.BFF.Role.Protobuf.csproj", "{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.User.Protobuf", "Protobufs\FrontOffice.BFF.User.Protobuf\FrontOffice.BFF.User.Protobuf.csproj", "{C8A16685-0A51-4D1A-B399-FB94C90D9BDC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.UserAddress.Protobuf", "Protobufs\FrontOffice.BFF.UserAddress.Protobuf\FrontOffice.BFF.UserAddress.Protobuf.csproj", "{D70F0C9A-E954-4A67-B23D-9BE22721BD5D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.UserOrder.Protobuf", "Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj", "{663CDDFA-E15F-4356-AE01-2311C9B83D52}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontOffice.BFF.UserRole.Protobuf", "Protobufs\FrontOffice.BFF.UserRole.Protobuf\FrontOffice.BFF.UserRole.Protobuf.csproj", "{AD08DE79-6341-4D17-85C4-8705E85CADEA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -50,10 +46,6 @@ Global
|
||||
{F4E98BE4-6F95-4B4E-924D-CBAD02AF24F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F4E98BE4-6F95-4B4E-924D-CBAD02AF24F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F4E98BE4-6F95-4B4E-924D-CBAD02AF24F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C8A16685-0A51-4D1A-B399-FB94C90D9BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C8A16685-0A51-4D1A-B399-FB94C90D9BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C8A16685-0A51-4D1A-B399-FB94C90D9BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -66,20 +58,14 @@ Global
|
||||
{663CDDFA-E15F-4356-AE01-2311C9B83D52}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{663CDDFA-E15F-4356-AE01-2311C9B83D52}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{663CDDFA-E15F-4356-AE01-2311C9B83D52}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD08DE79-6341-4D17-85C4-8705E85CADEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD08DE79-6341-4D17-85C4-8705E85CADEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD08DE79-6341-4D17-85C4-8705E85CADEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD08DE79-6341-4D17-85C4-8705E85CADEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{F4E98BE4-6F95-4B4E-924D-CBAD02AF24F1} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
{BC01390B-D8D3-4CC3-B900-6EE70A5D76F1} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
{C8A16685-0A51-4D1A-B399-FB94C90D9BDC} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
{D70F0C9A-E954-4A67-B23D-9BE22721BD5D} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
{663CDDFA-E15F-4356-AE01-2311C9B83D52} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
{AD08DE79-6341-4D17-85C4-8705E85CADEA} = {CA9BF4D6-6729-4011-888E-48F5F739B469}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.Package.Protobuf.Protos.Package;
|
||||
namespace FrontOffice.BFF.Package.Protobuf.Validator;
|
||||
|
||||
public class CreateNewPackageRequestValidator : AbstractValidator<CreateNewPackageRequest>
|
||||
{
|
||||
public CreateNewPackageRequestValidator()
|
||||
{
|
||||
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<CreateNewPackageRequest>.CreateWithOptions((CreateNewPackageRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.Package.Protobuf.Protos.Package;
|
||||
namespace FrontOffice.BFF.Package.Protobuf.Validator;
|
||||
|
||||
public class DeletePackageRequestValidator : AbstractValidator<DeletePackageRequest>
|
||||
{
|
||||
public DeletePackageRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeletePackageRequest>.CreateWithOptions((DeletePackageRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.Package.Protobuf.Protos.Package;
|
||||
namespace FrontOffice.BFF.Package.Protobuf.Validator;
|
||||
|
||||
public class UpdatePackageRequestValidator : AbstractValidator<UpdatePackageRequest>
|
||||
{
|
||||
public UpdatePackageRequestValidator()
|
||||
{
|
||||
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<UpdatePackageRequest>.CreateWithOptions((UpdatePackageRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using FluentValidation;
|
||||
using FrontOffice.BFF.User.Protobuf.Protos.User;
|
||||
namespace FrontOffice.BFF.User.Protobuf.Validator;
|
||||
|
||||
public class CreateNewUserRequestValidator : AbstractValidator<CreateNewUserRequest>
|
||||
{
|
||||
public CreateNewUserRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Mobile)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserRequest>.CreateWithOptions((CreateNewUserRequest)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