From 58ae7af0fa18672acae94a437b72511cfbf966dd Mon Sep 17 00:00:00 2001 From: stasex Date: Wed, 8 Nov 2023 14:29:40 +0200 Subject: [PATCH] added a new field to the Product entity and to Dtos --- .../Models/CreateDtos/ProductCreateDto.cs | 2 ++ ShoppingAssistantApi.Application/Models/Dtos/ProductDto.cs | 2 ++ ShoppingAssistantApi.Domain/Entities/Product.cs | 2 ++ ShoppingAssistantApi.Infrastructure/Services/ProductService.cs | 1 + 4 files changed, 7 insertions(+) diff --git a/ShoppingAssistantApi.Application/Models/CreateDtos/ProductCreateDto.cs b/ShoppingAssistantApi.Application/Models/CreateDtos/ProductCreateDto.cs index 015706c..01d900c 100644 --- a/ShoppingAssistantApi.Application/Models/CreateDtos/ProductCreateDto.cs +++ b/ShoppingAssistantApi.Application/Models/CreateDtos/ProductCreateDto.cs @@ -9,6 +9,8 @@ public class ProductCreateDto public required string Description { get; set; } public required double Rating { get; set; } + + public required double Price { get; set; } public required string[] ImagesUrls { get; set; } diff --git a/ShoppingAssistantApi.Application/Models/Dtos/ProductDto.cs b/ShoppingAssistantApi.Application/Models/Dtos/ProductDto.cs index 1697cd6..81cc6f0 100644 --- a/ShoppingAssistantApi.Application/Models/Dtos/ProductDto.cs +++ b/ShoppingAssistantApi.Application/Models/Dtos/ProductDto.cs @@ -12,6 +12,8 @@ public class ProductDto public required double Rating { get; set; } + public required double Price { get; set; } + public required string[] ImagesUrls { get; set; } public required bool WasOpened { get; set; } diff --git a/ShoppingAssistantApi.Domain/Entities/Product.cs b/ShoppingAssistantApi.Domain/Entities/Product.cs index 2085293..91e1cb1 100644 --- a/ShoppingAssistantApi.Domain/Entities/Product.cs +++ b/ShoppingAssistantApi.Domain/Entities/Product.cs @@ -17,6 +17,8 @@ public class Product : EntityBase public string[] ImagesUrls { get; set; } public bool WasOpened { get; set; } + + public double Price { get; set; } public ObjectId WishlistId { get; set; } } diff --git a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs index 8c4d567..a6f6ce1 100644 --- a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs +++ b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs @@ -152,6 +152,7 @@ public class ProductService : IProductService Name = productBuffer.Name, Rating = 0, Description = "", + Price = 0, ImagesUrls = new []{"", ""}, WasOpened = false }, cancellationToken);