From 962ab03c4c4f3e5e0a36be47287fbc4abed19c02 Mon Sep 17 00:00:00 2001 From: Mykhailo Bilodid Date: Sat, 21 Oct 2023 19:19:13 +0300 Subject: [PATCH] SA-33 comments and some changes added --- .../IServices/IProductService.cs | 5 ++-- .../Entities/Wishlist.cs | 2 -- .../Services/ProductService.cs | 5 ++-- .../PersistanceExtentions/DbInitialaizer.cs | 30 ------------------- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/ShoppingAssistantApi.Application/IServices/IProductService.cs b/ShoppingAssistantApi.Application/IServices/IProductService.cs index 8bd24b6..03a8545 100644 --- a/ShoppingAssistantApi.Application/IServices/IProductService.cs +++ b/ShoppingAssistantApi.Application/IServices/IProductService.cs @@ -7,10 +7,11 @@ namespace ShoppingAssistantApi.Application.IServices; public interface IProductService { - IAsyncEnumerable<(List ProductNames, WishlistDto Wishlist)> StartNewSearchAndReturnWishlist(Message message, CancellationToken cancellationToken); - IAsyncEnumerable SearchProductAsync(string wishlistId, MessageCreateDto message, CancellationToken cancellationToken); + // TODO remove all methods below + IAsyncEnumerable<(List ProductNames, WishlistDto Wishlist)> StartNewSearchAndReturnWishlist(Message message, CancellationToken cancellationToken); + IAsyncEnumerable GetProductFromSearch(Message message, CancellationToken cancellationToken); IAsyncEnumerable GetRecommendationsForProductFromSearchStream(Message message, diff --git a/ShoppingAssistantApi.Domain/Entities/Wishlist.cs b/ShoppingAssistantApi.Domain/Entities/Wishlist.cs index 4dee7fc..9c9bfc6 100644 --- a/ShoppingAssistantApi.Domain/Entities/Wishlist.cs +++ b/ShoppingAssistantApi.Domain/Entities/Wishlist.cs @@ -7,6 +7,4 @@ public class Wishlist : EntityBase public string Name { get; set; } public string Type { get; set; } - - public ICollection? Messages { get; set; } } diff --git a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs index c108f78..7bc99ed 100644 --- a/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs +++ b/ShoppingAssistantApi.Infrastructure/Services/ProductService.cs @@ -24,14 +24,15 @@ public class ProductService : IProductService _openAiService = openAiService; _wishlistsService = wishlistsService; } - + public IAsyncEnumerable SearchProductAsync(string wishlistId, MessageCreateDto message, CancellationToken cancellationToken) { - // get all messages from wishlist + // Documentation: https://shchoholiev.atlassian.net/l/cp/JizkynhU throw new NotImplementedException(); } + // TODO: remove all methods below public async IAsyncEnumerable<(List ProductNames, WishlistDto Wishlist)> StartNewSearchAndReturnWishlist(Message message, CancellationToken cancellationToken) { List messages = new List() diff --git a/ShoppingAssistantApi.Persistance/PersistanceExtentions/DbInitialaizer.cs b/ShoppingAssistantApi.Persistance/PersistanceExtentions/DbInitialaizer.cs index f96d491..4d40e28 100644 --- a/ShoppingAssistantApi.Persistance/PersistanceExtentions/DbInitialaizer.cs +++ b/ShoppingAssistantApi.Persistance/PersistanceExtentions/DbInitialaizer.cs @@ -187,25 +187,6 @@ public class DbInitialaizer Name = "Gaming PC", Type = WishlistTypes.Product.ToString(), CreatedById = user1.Id, - Messages = new Message[] - { - new Message - { - Text = "Prompt", - Role = MessageRoles.User.ToString(), - WishlistId = ObjectId.Parse("ab79cde6f69abcd3efab65cd"), - CreatedById = user1.Id, - CreatedDateUtc = DateTime.UtcNow - }, - new Message - { - Text = "Answer", - Role = MessageRoles.Application.ToString(), - WishlistId = ObjectId.Parse("ab79cde6f69abcd3efab65cd"), - CreatedById = user1.Id, - CreatedDateUtc = DateTime.UtcNow - }, - } }, new Wishlist { @@ -213,17 +194,6 @@ public class DbInitialaizer Name = "Generic Wishlist Name", Type = WishlistTypes.Product.ToString(), CreatedById = user2.Id, - Messages = new Message[] - { - new Message - { - Text = "Prompt", - Role = MessageRoles.User.ToString(), - WishlistId = ObjectId.Parse("ab6c2c2d9edf39abcd1ef9ab"), - CreatedById = user1.Id, - CreatedDateUtc = DateTime.UtcNow - } - } } };