This commit is contained in:
masoodafar-web
2025-11-17 20:58:12 +03:30
parent 4f038d33f3
commit 2446b2b76b
4 changed files with 211 additions and 293 deletions

View File

@@ -13840,290 +13840,6 @@
"dataCompressions": [] "dataCompressions": []
} }
}, },
{
"objectType": "Table_MSSQL",
"name": "ProductsService",
"comment": "سرویس های توکن Otp",
"owner": "",
"isChangeTracking": false,
"isTrackColumnsUpdated": false,
"oldName": "ProductsService",
"isSystemTable": false,
"createTime": "",
"modifyTime": "",
"objectID": 3023,
"numberOfRows": 0,
"identityCurrent": 0,
"dataLength": 0,
"indexLength": 0,
"fields": [
{
"objectType": "TableField_MSSQL",
"name": "GetProducts",
"type": "GetOneQuery",
"size": 0,
"isNullable": "Yes",
"scale": 0,
"comment": "واکشی یک توکن Otp",
"computedExpression": "",
"defaultValue": "",
"defaultValueType": "None",
"schema": "",
"userDefinedType": "",
"collate": "",
"isWithValues": false,
"isFilestream": false,
"isColumnSet": false,
"isPersisted": false,
"isSparse": false,
"isRowGUIDColumn": false,
"oldName": "GetProducts",
"computedBaseType": "",
"isDefaultConstraint": false,
"defaultConstraint": "",
"isIdentity": false,
"isExistingField": false,
"identitySeed": 0,
"identityIncrement": 0,
"identityIsNotForReplication": false
},
{
"objectType": "TableField_MSSQL",
"name": "GetAllProductsByFilter",
"type": "GetAllByFilterQuery",
"size": 0,
"isNullable": "Yes",
"scale": 0,
"comment": "واکشی توکن Otp ها بر مبنای فیلتر",
"computedExpression": "",
"defaultValue": "",
"defaultValueType": "Others",
"schema": "",
"userDefinedType": "",
"collate": "",
"isWithValues": false,
"isFilestream": false,
"isColumnSet": false,
"isPersisted": false,
"isSparse": false,
"isRowGUIDColumn": false,
"oldName": "GetAllProductsByFilter",
"computedBaseType": "",
"isDefaultConstraint": false,
"defaultConstraint": "",
"isIdentity": false,
"isExistingField": false,
"identitySeed": 0,
"identityIncrement": 0,
"identityIsNotForReplication": false
}
],
"indexes": [],
"primaryKey": {
"objectType": "PrimaryKey_MSSQL",
"name": "_copy_25",
"fields": [],
"fillFactor": 0,
"oldName": "",
"isClustered": true,
"isPadded": false,
"noRecomputeStatistics": false,
"ignoreDuplicatedKeyValues": false,
"allowRowLocks": true,
"allowPageLocks": true,
"storage": {
"objectType": "Storage_MSSQL",
"name": "",
"oldName": "",
"storageType": "Default",
"filegroup": "",
"textImageFilegroup": "",
"filestreamFilegroup": "",
"partitionScheme": "",
"partitionColumn": "",
"filestreamPartitionScheme": "",
"dataCompressions": []
}
},
"foreignKeys": [
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_CreateNewProductsRequest_1",
"fields": [
"CreateNewProducts"
],
"referencedSchema": "CMS",
"referencedTable": "CreateNewProductsRequest",
"referencedFields": [
"Title"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": false,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_CreateNewProductsResponse_1",
"fields": [
"CreateNewProducts"
],
"referencedSchema": "CMS",
"referencedTable": "CreateNewProductsResponse",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": false,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_UpdateProductsRequest_1",
"fields": [
"UpdateProducts"
],
"referencedSchema": "CMS",
"referencedTable": "UpdateProductsRequest",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": false,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_DeleteProductsRequest_1",
"fields": [
"DeleteProducts"
],
"referencedSchema": "CMS",
"referencedTable": "DeleteProductsRequest",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": false,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetProductsResponse_1",
"fields": [
"GetProducts"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetProductsResponse",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetProductsRequest_1",
"fields": [
"GetProducts"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetProductsRequest",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetAllProductsByFilterResponse_1",
"fields": [
"GetAllProductsByFilter"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetAllProductsByFilterResponse",
"referencedFields": [
"MetaData"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetAllProductsByFilterRequest_1",
"fields": [
"GetAllProductsByFilter"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetAllProductsByFilterRequest",
"referencedFields": [
"PaginationState"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
}
],
"uniques": [],
"checks": [],
"triggers": [],
"storage": {
"objectType": "Storage_MSSQL",
"name": "",
"oldName": "",
"storageType": "Default",
"filegroup": "",
"textImageFilegroup": "",
"filestreamFilegroup": "",
"partitionScheme": "",
"partitionColumn": "",
"filestreamPartitionScheme": "",
"dataCompressions": []
}
},
{ {
"objectType": "Table_MSSQL", "objectType": "Table_MSSQL",
"name": "GetProductsResponse", "name": "GetProductsResponse",
@@ -15739,6 +15455,210 @@
"filestreamPartitionScheme": "", "filestreamPartitionScheme": "",
"dataCompressions": [] "dataCompressions": []
} }
},
{
"objectType": "Table_MSSQL",
"name": "ProductsService",
"comment": "سرویس محصولات ",
"owner": "",
"isChangeTracking": false,
"isTrackColumnsUpdated": false,
"oldName": "ProductsService",
"isSystemTable": false,
"createTime": "",
"modifyTime": "",
"objectID": 3023,
"numberOfRows": 0,
"identityCurrent": 0,
"dataLength": 0,
"indexLength": 0,
"fields": [
{
"objectType": "TableField_MSSQL",
"name": "GetProducts",
"type": "GetOneQuery",
"size": 0,
"isNullable": "Yes",
"scale": 0,
"comment": "واکشی یک توکن Otp",
"computedExpression": "",
"defaultValue": "",
"defaultValueType": "None",
"schema": "",
"userDefinedType": "",
"collate": "",
"isWithValues": false,
"isFilestream": false,
"isColumnSet": false,
"isPersisted": false,
"isSparse": false,
"isRowGUIDColumn": false,
"oldName": "GetProducts",
"computedBaseType": "",
"isDefaultConstraint": false,
"defaultConstraint": "",
"isIdentity": false,
"isExistingField": false,
"identitySeed": 0,
"identityIncrement": 0,
"identityIsNotForReplication": false
},
{
"objectType": "TableField_MSSQL",
"name": "GetAllProductsByFilter",
"type": "GetAllByFilterQuery",
"size": 0,
"isNullable": "Yes",
"scale": 0,
"comment": "واکشی توکن Otp ها بر مبنای فیلتر",
"computedExpression": "",
"defaultValue": "",
"defaultValueType": "Others",
"schema": "",
"userDefinedType": "",
"collate": "",
"isWithValues": false,
"isFilestream": false,
"isColumnSet": false,
"isPersisted": false,
"isSparse": false,
"isRowGUIDColumn": false,
"oldName": "GetAllProductsByFilter",
"computedBaseType": "",
"isDefaultConstraint": false,
"defaultConstraint": "",
"isIdentity": false,
"isExistingField": false,
"identitySeed": 0,
"identityIncrement": 0,
"identityIsNotForReplication": false
}
],
"indexes": [],
"primaryKey": {
"objectType": "PrimaryKey_MSSQL",
"name": "_copy_25",
"fields": [],
"fillFactor": 0,
"oldName": "",
"isClustered": true,
"isPadded": false,
"noRecomputeStatistics": false,
"ignoreDuplicatedKeyValues": false,
"allowRowLocks": true,
"allowPageLocks": true,
"storage": {
"objectType": "Storage_MSSQL",
"name": "",
"oldName": "",
"storageType": "Default",
"filegroup": "",
"textImageFilegroup": "",
"filestreamFilegroup": "",
"partitionScheme": "",
"partitionColumn": "",
"filestreamPartitionScheme": "",
"dataCompressions": []
}
},
"foreignKeys": [
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetProductsResponse_1",
"fields": [
"GetProducts"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetProductsResponse",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetProductsRequest_1",
"fields": [
"GetProducts"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetProductsRequest",
"referencedFields": [
"Id"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetAllProductsByFilterResponse_1",
"fields": [
"GetAllProductsByFilter"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetAllProductsByFilterResponse",
"referencedFields": [
"MetaData"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
},
{
"objectType": "ForeignKey_MSSQL",
"name": "fk_ProductsService_GetAllProductsByFilterRequest_1",
"fields": [
"GetAllProductsByFilter"
],
"referencedSchema": "FrontOffice",
"referencedTable": "GetAllProductsByFilterRequest",
"referencedFields": [
"PaginationState"
],
"onDelete": "",
"onUpdate": "",
"isNotForReplication": false,
"isEnabled": true,
"comment": "",
"sourceCardinality": "NoneRelationship",
"targetCardinality": "NoneRelationship",
"oldName": ""
}
],
"uniques": [],
"checks": [],
"triggers": [],
"storage": {
"objectType": "Storage_MSSQL",
"name": "",
"oldName": "",
"storageType": "Default",
"filegroup": "",
"textImageFilegroup": "",
"filestreamFilegroup": "",
"partitionScheme": "",
"partitionColumn": "",
"filestreamPartitionScheme": "",
"dataCompressions": []
}
} }
], ],
"views": [] "views": []

View File

@@ -13,7 +13,7 @@ public class GetAllProductsByFilterQueryHandler : IRequestHandler<GetAllProducts
public async Task<GetAllProductsByFilterResponseDto> Handle(GetAllProductsByFilterQuery request, CancellationToken cancellationToken) public async Task<GetAllProductsByFilterResponseDto> Handle(GetAllProductsByFilterQuery request, CancellationToken cancellationToken)
{ {
await _context.Package.GetAllPackageByFilterAsync(request.Adapt<GetAllPackageByFilterRequest>(), cancellationToken: cancellationToken); var result= await _context.Package.GetAllPackageByFilterAsync(request.Adapt<GetAllPackageByFilterRequest>(), cancellationToken: cancellationToken);
return new GetAllProductsByFilterResponseDto(); return result.Adapt<GetAllProductsByFilterResponseDto>();
} }
} }

View File

@@ -1,3 +1,5 @@
using CMSMicroservice.Protobuf.Protos.Products;
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts; namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts;
public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, GetProductsResponseDto> public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, GetProductsResponseDto>
{ {
@@ -11,12 +13,8 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, GetProd
public async Task<GetProductsResponseDto> Handle(GetProductsQuery request, public async Task<GetProductsResponseDto> Handle(GetProductsQuery request,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var response = await _context.Productss var response = await _context.Product.GetProductsAsync(request.Adapt<GetProductsRequest>(), cancellationToken: cancellationToken);
.AsNoTracking()
.Where(x => x.Id == request.Id)
.ProjectToType<GetProductsResponseDto>()
.FirstOrDefaultAsync(cancellationToken);
return response ?? throw new NotFoundException(nameof(Products), request.Id); return response ==null? throw new NotFoundException(nameof(ProductsContract.ProductsContractClient), request.Id):response.Adapt<GetProductsResponseDto>();
} }
} }

View File

@@ -1,4 +1,4 @@
using FrontOffice.BFF.Protobuf.Protos.Products; using CMSMicroservice.Protobuf.Protos.Products;
using FrontOffice.BFF.WebApi.Common.Services; using FrontOffice.BFF.WebApi.Common.Services;
using FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts; using FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts;
using FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter; using FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;