From 7840f3b463e700323dba955dc51debb8b917bd3f Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Thu, 20 Nov 2025 00:40:28 +0330 Subject: [PATCH] update --- docs/model.ndm2 | 586 ++++++++++++------ .../CreateNewCategoryCommandHandler.cs | 2 +- .../DeleteCategoryCommandHandler.cs | 4 +- .../UpdateCategoryCommandHandler.cs | 4 +- .../GetAllCategoryByFilterQueryHandler.cs | 2 +- .../GetCategory/GetCategoryQueryHandler.cs | 2 +- .../Configurations/CategoryConfiguration.cs | 2 +- .../CMSMicroservice.Protobuf.csproj | 3 +- .../CreateNewCategoryRequestValidator.cs | 1 + 9 files changed, 409 insertions(+), 197 deletions(-) diff --git a/docs/model.ndm2 b/docs/model.ndm2 index 9b62053..036c5ef 100644 --- a/docs/model.ndm2 +++ b/docs/model.ndm2 @@ -25157,191 +25157,6 @@ "dataCompressions": [] } }, - { - "objectType": "Table_MSSQL", - "name": "GetAllUserCartsByFilterResponseModel", - "comment": "مدل خروجی آدرس کاربر بر مبنای فیلتر", - "owner": "", - "isChangeTracking": false, - "isTrackColumnsUpdated": false, - "oldName": "GetAllUserCartsByFilterResponseModel", - "isSystemTable": false, - "createTime": "", - "modifyTime": "", - "objectID": 1174, - "numberOfRows": 0, - "identityCurrent": 0, - "dataLength": 0, - "indexLength": 0, - "fields": [ - { - "objectType": "TableField_MSSQL", - "name": "Id", - "type": "bigint", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "None", - "schema": "sys", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Id", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": true, - "isExistingField": false, - "identitySeed": -2147483648, - "identityIncrement": -2147483648, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "ProductId", - "type": "bigint", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "None", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "ProductId", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "UserId", - "type": "bigint", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "None", - "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 - }, - { - "objectType": "TableField_MSSQL", - "name": "Count", - "type": "int", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "None", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Count", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - } - ], - "indexes": [], - "primaryKey": { - "objectType": "PrimaryKey_MSSQL", - "name": "_copy_84", - "fields": [ - "Id" - ], - "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": "ProductGallerysService", @@ -49481,6 +49296,401 @@ "filestreamPartitionScheme": "", "dataCompressions": [] } + }, + { + "objectType": "Table_MSSQL", + "name": "GetAllUserCartsByFilterResponseModel", + "comment": "مدل خروجی آدرس کاربر بر مبنای فیلتر", + "owner": "", + "isChangeTracking": false, + "isTrackColumnsUpdated": false, + "oldName": "GetAllUserCartsByFilterResponseModel", + "isSystemTable": false, + "createTime": "", + "modifyTime": "", + "objectID": 1174, + "numberOfRows": 0, + "identityCurrent": 0, + "dataLength": 0, + "indexLength": 0, + "fields": [ + { + "objectType": "TableField_MSSQL", + "name": "Id", + "type": "bigint", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Id", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": true, + "isExistingField": false, + "identitySeed": -2147483648, + "identityIncrement": -2147483648, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductId", + "type": "bigint", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductId", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "UserId", + "type": "bigint", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "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 + }, + { + "objectType": "TableField_MSSQL", + "name": "Count", + "type": "int", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Count", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductTitle", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "SQL_Latin1_General_CP1_CI_AS", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductTitle", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductShortInfomation", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "SQL_Latin1_General_CP1_CI_AS", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductShortInfomation", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductPrice", + "type": "bigint", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductPrice", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductDiscount", + "type": "int", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductDiscount", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ProductThumbnailPath", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "sys", + "userDefinedType": "", + "collate": "SQL_Latin1_General_CP1_CI_AS", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ProductThumbnailPath", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Count", + "type": "int", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Count", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Created", + "type": "datetime2", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Created", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MSSQL", + "name": "_copy_84", + "fields": [ + "Id" + ], + "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": [] @@ -51396,7 +51606,7 @@ "schemaName": "CMS", "tableName": "CreateNewUserCartsRequest", "x": 14970, - "y": 13550, + "y": 13704, "width": 400, "height": 156, "isBold": false, @@ -51542,7 +51752,7 @@ "x": 15120, "y": 13280, "width": 400, - "height": 156, + "height": 334, "isBold": false, "titleColor": { "r": 200, @@ -57801,7 +58011,7 @@ }, { "x": 15170, - "y": 13535 + "y": 13689 } ], "label": { diff --git a/src/CMSMicroservice.Application/CategoryCQ/Commands/CreateNewCategory/CreateNewCategoryCommandHandler.cs b/src/CMSMicroservice.Application/CategoryCQ/Commands/CreateNewCategory/CreateNewCategoryCommandHandler.cs index e4429aa..67afe47 100644 --- a/src/CMSMicroservice.Application/CategoryCQ/Commands/CreateNewCategory/CreateNewCategoryCommandHandler.cs +++ b/src/CMSMicroservice.Application/CategoryCQ/Commands/CreateNewCategory/CreateNewCategoryCommandHandler.cs @@ -13,7 +13,7 @@ public class CreateNewCategoryCommandHandler : IRequestHandler(); - await _context.Categories.AddAsync(entity, cancellationToken); + await _context.Categorys.AddAsync(entity, cancellationToken); entity.AddDomainEvent(new CreateNewCategoryEvent(entity)); await _context.SaveChangesAsync(cancellationToken); return entity.Adapt(); diff --git a/src/CMSMicroservice.Application/CategoryCQ/Commands/DeleteCategory/DeleteCategoryCommandHandler.cs b/src/CMSMicroservice.Application/CategoryCQ/Commands/DeleteCategory/DeleteCategoryCommandHandler.cs index 0b79ec8..b6293d3 100644 --- a/src/CMSMicroservice.Application/CategoryCQ/Commands/DeleteCategory/DeleteCategoryCommandHandler.cs +++ b/src/CMSMicroservice.Application/CategoryCQ/Commands/DeleteCategory/DeleteCategoryCommandHandler.cs @@ -11,10 +11,10 @@ public class DeleteCategoryCommandHandler : IRequestHandler Handle(DeleteCategoryCommand request, CancellationToken cancellationToken) { - var entity = await _context.Categories + var entity = await _context.Categorys .FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken) ?? throw new NotFoundException(nameof(Category), request.Id); entity.IsDeleted = true; - _context.Categories.Update(entity); + _context.Categorys.Update(entity); entity.AddDomainEvent(new DeleteCategoryEvent(entity)); await _context.SaveChangesAsync(cancellationToken); return Unit.Value; diff --git a/src/CMSMicroservice.Application/CategoryCQ/Commands/UpdateCategory/UpdateCategoryCommandHandler.cs b/src/CMSMicroservice.Application/CategoryCQ/Commands/UpdateCategory/UpdateCategoryCommandHandler.cs index ab26b1c..5efef2a 100644 --- a/src/CMSMicroservice.Application/CategoryCQ/Commands/UpdateCategory/UpdateCategoryCommandHandler.cs +++ b/src/CMSMicroservice.Application/CategoryCQ/Commands/UpdateCategory/UpdateCategoryCommandHandler.cs @@ -11,10 +11,10 @@ public class UpdateCategoryCommandHandler : IRequestHandler Handle(UpdateCategoryCommand request, CancellationToken cancellationToken) { - var entity = await _context.Categories + var entity = await _context.Categorys .FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken) ?? throw new NotFoundException(nameof(Category), request.Id); request.Adapt(entity); - _context.Categories.Update(entity); + _context.Categorys.Update(entity); entity.AddDomainEvent(new UpdateCategoryEvent(entity)); await _context.SaveChangesAsync(cancellationToken); return Unit.Value; diff --git a/src/CMSMicroservice.Application/CategoryCQ/Queries/GetAllCategoryByFilter/GetAllCategoryByFilterQueryHandler.cs b/src/CMSMicroservice.Application/CategoryCQ/Queries/GetAllCategoryByFilter/GetAllCategoryByFilterQueryHandler.cs index 3d30861..b5782fb 100644 --- a/src/CMSMicroservice.Application/CategoryCQ/Queries/GetAllCategoryByFilter/GetAllCategoryByFilterQueryHandler.cs +++ b/src/CMSMicroservice.Application/CategoryCQ/Queries/GetAllCategoryByFilter/GetAllCategoryByFilterQueryHandler.cs @@ -10,7 +10,7 @@ public class GetAllCategoryByFilterQueryHandler : IRequestHandler Handle(GetAllCategoryByFilterQuery request, CancellationToken cancellationToken) { - var query = _context.Categories + var query = _context.Categorys .ApplyOrder(sortBy: request.SortBy) .AsNoTracking() .AsQueryable(); diff --git a/src/CMSMicroservice.Application/CategoryCQ/Queries/GetCategory/GetCategoryQueryHandler.cs b/src/CMSMicroservice.Application/CategoryCQ/Queries/GetCategory/GetCategoryQueryHandler.cs index a1f7654..9b7700f 100644 --- a/src/CMSMicroservice.Application/CategoryCQ/Queries/GetCategory/GetCategoryQueryHandler.cs +++ b/src/CMSMicroservice.Application/CategoryCQ/Queries/GetCategory/GetCategoryQueryHandler.cs @@ -11,7 +11,7 @@ public class GetCategoryQueryHandler : IRequestHandler Handle(GetCategoryQuery request, CancellationToken cancellationToken) { - var response = await _context.Categories + var response = await _context.Categorys .AsNoTracking() .Where(x => x.Id == request.Id) .ProjectToType() diff --git a/src/CMSMicroservice.Infrastructure/Persistence/Configurations/CategoryConfiguration.cs b/src/CMSMicroservice.Infrastructure/Persistence/Configurations/CategoryConfiguration.cs index 2a96221..be33805 100644 --- a/src/CMSMicroservice.Infrastructure/Persistence/Configurations/CategoryConfiguration.cs +++ b/src/CMSMicroservice.Infrastructure/Persistence/Configurations/CategoryConfiguration.cs @@ -22,7 +22,7 @@ public class CategoryConfiguration : IEntityTypeConfiguration builder .HasOne(entity => entity.Parent) - .WithMany(entity => entity.Categories) + .WithMany(entity => entity.Categorys) .HasForeignKey(entity => entity.ParentId) .IsRequired(false); } diff --git a/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj b/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj index 6d0176b..9fc53e1 100644 --- a/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj +++ b/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj @@ -3,7 +3,7 @@ net9.0 enable enable - 0.0.119 + 0.0.121 None False False @@ -40,6 +40,7 @@ + diff --git a/src/CMSMicroservice.Protobuf/Validator/Category/CreateNewCategoryRequestValidator.cs b/src/CMSMicroservice.Protobuf/Validator/Category/CreateNewCategoryRequestValidator.cs index b507c2d..3c9531f 100644 --- a/src/CMSMicroservice.Protobuf/Validator/Category/CreateNewCategoryRequestValidator.cs +++ b/src/CMSMicroservice.Protobuf/Validator/Category/CreateNewCategoryRequestValidator.cs @@ -1,5 +1,6 @@ using FluentValidation; using CMSMicroservice.Protobuf.Protos.Category; + namespace CMSMicroservice.Protobuf.Validator.Category; public class CreateNewCategoryRequestValidator : AbstractValidator