From 2446b2b76bed1c198315a826f2126907a2bbb5ba Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Mon, 17 Nov 2025 20:58:12 +0330 Subject: [PATCH] update --- docs/model.ndm2 | 488 ++++++++---------- .../GetAllProductsByFilterQueryHandler.cs | 4 +- .../GetProducts/GetProductsQueryHandler.cs | 10 +- .../Services/ProductsService.cs | 2 +- 4 files changed, 211 insertions(+), 293 deletions(-) diff --git a/docs/model.ndm2 b/docs/model.ndm2 index 473402b..0ab69fb 100644 --- a/docs/model.ndm2 +++ b/docs/model.ndm2 @@ -13840,290 +13840,6 @@ "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", "name": "GetProductsResponse", @@ -15739,6 +15455,210 @@ "filestreamPartitionScheme": "", "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": [] diff --git a/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetAllProductsByFilter/GetAllProductsByFilterQueryHandler.cs b/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetAllProductsByFilter/GetAllProductsByFilterQueryHandler.cs index 23775ea..6046413 100644 --- a/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetAllProductsByFilter/GetAllProductsByFilterQueryHandler.cs +++ b/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetAllProductsByFilter/GetAllProductsByFilterQueryHandler.cs @@ -13,7 +13,7 @@ public class GetAllProductsByFilterQueryHandler : IRequestHandler Handle(GetAllProductsByFilterQuery request, CancellationToken cancellationToken) { - await _context.Package.GetAllPackageByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); - return new GetAllProductsByFilterResponseDto(); + var result= await _context.Package.GetAllPackageByFilterAsync(request.Adapt(), cancellationToken: cancellationToken); + return result.Adapt(); } } diff --git a/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetProducts/GetProductsQueryHandler.cs b/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetProducts/GetProductsQueryHandler.cs index 7e06e94..a2147ae 100644 --- a/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetProducts/GetProductsQueryHandler.cs +++ b/src/FrontOffice.BFF.Application/ProductsCQ/Queries/GetProducts/GetProductsQueryHandler.cs @@ -1,3 +1,5 @@ +using CMSMicroservice.Protobuf.Protos.Products; + namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts; public class GetProductsQueryHandler : IRequestHandler { @@ -11,12 +13,8 @@ public class GetProductsQueryHandler : IRequestHandler Handle(GetProductsQuery request, CancellationToken cancellationToken) { - var response = await _context.Productss - .AsNoTracking() - .Where(x => x.Id == request.Id) - .ProjectToType() - .FirstOrDefaultAsync(cancellationToken); + var response = await _context.Product.GetProductsAsync(request.Adapt(), cancellationToken: cancellationToken); - return response ?? throw new NotFoundException(nameof(Products), request.Id); + return response ==null? throw new NotFoundException(nameof(ProductsContract.ProductsContractClient), request.Id):response.Adapt(); } } diff --git a/src/FrontOffice.BFF.WebApi/Services/ProductsService.cs b/src/FrontOffice.BFF.WebApi/Services/ProductsService.cs index 210f34d..6cbe184 100644 --- a/src/FrontOffice.BFF.WebApi/Services/ProductsService.cs +++ b/src/FrontOffice.BFF.WebApi/Services/ProductsService.cs @@ -1,4 +1,4 @@ -using FrontOffice.BFF.Protobuf.Protos.Products; +using CMSMicroservice.Protobuf.Protos.Products; using FrontOffice.BFF.WebApi.Common.Services; using FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts; using FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;