From a99e1b05b4e2bb138563311c61342e8eb12c4c4a Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Sun, 9 Jun 2024 23:27:41 +0900 Subject: [PATCH 01/16] =?UTF-8?q?Feat:=20Recipe,RecipeType=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes.xcodeproj/project.pbxproj | 48 +++++++++++++++++++ .../Domain/Entities/Recipe.swift | 20 ++++++++ .../Domain/Entities/RecipeType.swift | 13 +++++ 3 files changed, 81 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/RecipeType.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj index f47c7eb..19d9419 100644 --- a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj +++ b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj @@ -7,6 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 1D1283A22C15E94300C5A870 /* Recipe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A12C15E94300C5A870 /* Recipe.swift */; }; + 1D1283A42C15EA8100C5A870 /* RecipeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A32C15EA8100C5A870 /* RecipeType.swift */; }; + 1D1283A62C15EAA600C5A870 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A52C15EAA600C5A870 /* User.swift */; }; + 1D1283A82C15EABB00C5A870 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A72C15EABB00C5A870 /* Comment.swift */; }; + 1D1283AA2C15EBCF00C5A870 /* SearchFeedUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A92C15EBCF00C5A870 /* SearchFeedUseCase.swift */; }; + 1D1283AC2C15EBE600C5A870 /* FetchFeedListUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283AB2C15EBE600C5A870 /* FetchFeedListUseCase.swift */; }; 1D2C16E62BE532B700C04508 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E52BE532B700C04508 /* AppDelegate.swift */; }; 1D2C16E82BE532B700C04508 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */; }; 1D2C16EA2BE532B700C04508 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E92BE532B700C04508 /* ViewController.swift */; }; @@ -35,6 +41,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1D1283A12C15E94300C5A870 /* Recipe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Recipe.swift; sourceTree = ""; }; + 1D1283A32C15EA8100C5A870 /* RecipeType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeType.swift; sourceTree = ""; }; + 1D1283A52C15EAA600C5A870 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + 1D1283A72C15EABB00C5A870 /* Comment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comment.swift; sourceTree = ""; }; + 1D1283A92C15EBCF00C5A870 /* SearchFeedUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchFeedUseCase.swift; sourceTree = ""; }; + 1D1283AB2C15EBE600C5A870 /* FetchFeedListUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchFeedListUseCase.swift; sourceTree = ""; }; 1D2C16E22BE532B700C04508 /* HomeCafeRecipes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HomeCafeRecipes.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1D2C16E52BE532B700C04508 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -74,6 +86,26 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1D12839F2C15E7A700C5A870 /* Entities */ = { + isa = PBXGroup; + children = ( + 1D1283A12C15E94300C5A870 /* Recipe.swift */, + 1D1283A32C15EA8100C5A870 /* RecipeType.swift */, + 1D1283A52C15EAA600C5A870 /* User.swift */, + 1D1283A72C15EABB00C5A870 /* Comment.swift */, + ); + path = Entities; + sourceTree = ""; + }; + 1D1283A02C15E92C00C5A870 /* UseCases */ = { + isa = PBXGroup; + children = ( + 1D1283A92C15EBCF00C5A870 /* SearchFeedUseCase.swift */, + 1D1283AB2C15EBE600C5A870 /* FetchFeedListUseCase.swift */, + ); + path = UseCases; + sourceTree = ""; + }; 1D2C16D92BE532B700C04508 = { isa = PBXGroup; children = ( @@ -97,6 +129,7 @@ 1D2C16E42BE532B700C04508 /* HomeCafeRecipes */ = { isa = PBXGroup; children = ( + 1D740B402C15E6680001B704 /* Domain */, 1D2C16E52BE532B700C04508 /* AppDelegate.swift */, 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */, 1D2C16E92BE532B700C04508 /* ViewController.swift */, @@ -124,6 +157,15 @@ path = HomeCafeRecipesUITests; sourceTree = ""; }; + 1D740B402C15E6680001B704 /* Domain */ = { + isa = PBXGroup; + children = ( + 1D1283A02C15E92C00C5A870 /* UseCases */, + 1D12839F2C15E7A700C5A870 /* Entities */, + ); + path = Domain; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -261,7 +303,13 @@ files = ( 1D2C16EA2BE532B700C04508 /* ViewController.swift in Sources */, 1D2C16E62BE532B700C04508 /* AppDelegate.swift in Sources */, + 1D1283A62C15EAA600C5A870 /* User.swift in Sources */, + 1D1283AC2C15EBE600C5A870 /* FetchFeedListUseCase.swift in Sources */, + 1D1283A82C15EABB00C5A870 /* Comment.swift in Sources */, + 1D1283A42C15EA8100C5A870 /* RecipeType.swift in Sources */, + 1D1283AA2C15EBCF00C5A870 /* SearchFeedUseCase.swift in Sources */, 1D2C16E82BE532B700C04508 /* SceneDelegate.swift in Sources */, + 1D1283A22C15E94300C5A870 /* Recipe.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift new file mode 100644 index 0000000..696ce78 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift @@ -0,0 +1,20 @@ +// +// Recipe.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/9/24. +// + +import Foundation + +struct Recipe { + let id: Int + let type: RecipeType + let name: String + let description: String + let writer: User + let imageUrls: [String] + let isLiked: Bool + let likeCount: Int + let createdAt: Date +} diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/RecipeType.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/RecipeType.swift new file mode 100644 index 0000000..57c7b1b --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/RecipeType.swift @@ -0,0 +1,13 @@ +// +// RecipeType.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/9/24. +// + + + +enum RecipeType: String { + case coffee + case dessert +} From 52c981f357c222ee1e91dd4f68b0ff5158861b2c Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Mon, 10 Jun 2024 16:05:06 +0900 Subject: [PATCH 02/16] =?UTF-8?q?Feat:=20FetchFeedListUseCase,SearchFeedLi?= =?UTF-8?q?stUseCase=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes.xcodeproj/project.pbxproj | 114 ++++++++++++++++++ .../UseCases/FetchFeedListUseCase.swift | 30 +++++ .../Domain/UseCases/SearchFeedUseCase.swift | 30 +++++ 3 files changed, 174 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj index 19d9419..2773df9 100644 --- a/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj +++ b/HomeCafeRecipes/HomeCafeRecipes.xcodeproj/project.pbxproj @@ -13,6 +13,17 @@ 1D1283A82C15EABB00C5A870 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A72C15EABB00C5A870 /* Comment.swift */; }; 1D1283AA2C15EBCF00C5A870 /* SearchFeedUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283A92C15EBCF00C5A870 /* SearchFeedUseCase.swift */; }; 1D1283AC2C15EBE600C5A870 /* FetchFeedListUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283AB2C15EBE600C5A870 /* FetchFeedListUseCase.swift */; }; + 1D1283AF2C1697DB00C5A870 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 1D1283AE2C1697DB00C5A870 /* RxCocoa */; }; + 1D1283B12C1697DB00C5A870 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 1D1283B02C1697DB00C5A870 /* RxSwift */; }; + 1D1283B42C16983900C5A870 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 1D1283B32C16983900C5A870 /* RxSwift */; }; + 1D1283B62C16984E00C5A870 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 1D1283B52C16984E00C5A870 /* RxCocoa */; }; + 1D1283B82C169C0200C5A870 /* FeedListRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283B72C169C0200C5A870 /* FeedListRepository.swift */; }; + 1D1283BA2C16A62800C5A870 /* SearchFeedListRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283B92C16A62800C5A870 /* SearchFeedListRepository.swift */; }; + 1D1283C12C16B05800C5A870 /* RecipeDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283C02C16B05800C5A870 /* RecipeDTO.swift */; }; + 1D1283C32C16B06F00C5A870 /* UserDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283C22C16B06F00C5A870 /* UserDTO.swift */; }; + 1D1283C52C16B07D00C5A870 /* CommentDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283C42C16B07D00C5A870 /* CommentDTO.swift */; }; + 1D1283C82C16CE7C00C5A870 /* DateFormatter+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283C72C16CE7C00C5A870 /* DateFormatter+Extensions.swift */; }; + 1D1283CA2C16D9C600C5A870 /* RecipeFetchService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1283C92C16D9C600C5A870 /* RecipeFetchService.swift */; }; 1D2C16E62BE532B700C04508 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E52BE532B700C04508 /* AppDelegate.swift */; }; 1D2C16E82BE532B700C04508 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */; }; 1D2C16EA2BE532B700C04508 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2C16E92BE532B700C04508 /* ViewController.swift */; }; @@ -47,6 +58,13 @@ 1D1283A72C15EABB00C5A870 /* Comment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comment.swift; sourceTree = ""; }; 1D1283A92C15EBCF00C5A870 /* SearchFeedUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchFeedUseCase.swift; sourceTree = ""; }; 1D1283AB2C15EBE600C5A870 /* FetchFeedListUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchFeedListUseCase.swift; sourceTree = ""; }; + 1D1283B72C169C0200C5A870 /* FeedListRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListRepository.swift; sourceTree = ""; }; + 1D1283B92C16A62800C5A870 /* SearchFeedListRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchFeedListRepository.swift; sourceTree = ""; }; + 1D1283C02C16B05800C5A870 /* RecipeDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeDTO.swift; sourceTree = ""; }; + 1D1283C22C16B06F00C5A870 /* UserDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDTO.swift; sourceTree = ""; }; + 1D1283C42C16B07D00C5A870 /* CommentDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentDTO.swift; sourceTree = ""; }; + 1D1283C72C16CE7C00C5A870 /* DateFormatter+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extensions.swift"; sourceTree = ""; }; + 1D1283C92C16D9C600C5A870 /* RecipeFetchService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipeFetchService.swift; sourceTree = ""; }; 1D2C16E22BE532B700C04508 /* HomeCafeRecipes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HomeCafeRecipes.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1D2C16E52BE532B700C04508 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -66,6 +84,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1D1283B12C1697DB00C5A870 /* RxSwift in Frameworks */, + 1D1283AF2C1697DB00C5A870 /* RxCocoa in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -80,6 +100,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1D1283B62C16984E00C5A870 /* RxCocoa in Frameworks */, + 1D1283B42C16983900C5A870 /* RxSwift in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -106,6 +128,59 @@ path = UseCases; sourceTree = ""; }; + 1D1283AD2C16974B00C5A870 /* Data */ = { + isa = PBXGroup; + children = ( + 1D1283BC2C16AA8100C5A870 /* Network */, + 1D1283BB2C16AA6400C5A870 /* Repositories */, + ); + path = Data; + sourceTree = ""; + }; + 1D1283B22C16983900C5A870 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 1D1283BB2C16AA6400C5A870 /* Repositories */ = { + isa = PBXGroup; + children = ( + 1D1283B72C169C0200C5A870 /* FeedListRepository.swift */, + 1D1283B92C16A62800C5A870 /* SearchFeedListRepository.swift */, + ); + name = Repositories; + path = "ㄲ데ㅐ냐새갿ㄴ"; + sourceTree = ""; + }; + 1D1283BC2C16AA8100C5A870 /* Network */ = { + isa = PBXGroup; + children = ( + 1D1283BF2C16B02600C5A870 /* DTO */, + 1D1283C92C16D9C600C5A870 /* RecipeFetchService.swift */, + ); + path = Network; + sourceTree = ""; + }; + 1D1283BF2C16B02600C5A870 /* DTO */ = { + isa = PBXGroup; + children = ( + 1D1283C02C16B05800C5A870 /* RecipeDTO.swift */, + 1D1283C22C16B06F00C5A870 /* UserDTO.swift */, + 1D1283C42C16B07D00C5A870 /* CommentDTO.swift */, + ); + path = DTO; + sourceTree = ""; + }; + 1D1283C62C16CD9200C5A870 /* Utilities */ = { + isa = PBXGroup; + children = ( + 1D1283C72C16CE7C00C5A870 /* DateFormatter+Extensions.swift */, + ); + path = Utilities; + sourceTree = ""; + }; 1D2C16D92BE532B700C04508 = { isa = PBXGroup; children = ( @@ -113,6 +188,7 @@ 1D2C16FB2BE532B800C04508 /* HomeCafeRecipesTests */, 1D2C17052BE532B800C04508 /* HomeCafeRecipesUITests */, 1D2C16E32BE532B700C04508 /* Products */, + 1D1283B22C16983900C5A870 /* Frameworks */, ); sourceTree = ""; }; @@ -129,6 +205,8 @@ 1D2C16E42BE532B700C04508 /* HomeCafeRecipes */ = { isa = PBXGroup; children = ( + 1D1283C62C16CD9200C5A870 /* Utilities */, + 1D1283AD2C16974B00C5A870 /* Data */, 1D740B402C15E6680001B704 /* Domain */, 1D2C16E52BE532B700C04508 /* AppDelegate.swift */, 1D2C16E72BE532B700C04508 /* SceneDelegate.swift */, @@ -183,6 +261,8 @@ ); name = HomeCafeRecipes; packageProductDependencies = ( + 1D1283AE2C1697DB00C5A870 /* RxCocoa */, + 1D1283B02C1697DB00C5A870 /* RxSwift */, ); productName = HomeCafeRecipes; productReference = 1D2C16E22BE532B700C04508 /* HomeCafeRecipes.app */; @@ -220,6 +300,10 @@ 1D2C17042BE532B800C04508 /* PBXTargetDependency */, ); name = HomeCafeRecipesUITests; + packageProductDependencies = ( + 1D1283B32C16983900C5A870 /* RxSwift */, + 1D1283B52C16984E00C5A870 /* RxCocoa */, + ); productName = HomeCafeRecipesUITests; productReference = 1D2C17022BE532B800C04508 /* HomeCafeRecipesUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; @@ -304,12 +388,19 @@ 1D2C16EA2BE532B700C04508 /* ViewController.swift in Sources */, 1D2C16E62BE532B700C04508 /* AppDelegate.swift in Sources */, 1D1283A62C15EAA600C5A870 /* User.swift in Sources */, + 1D1283C52C16B07D00C5A870 /* CommentDTO.swift in Sources */, 1D1283AC2C15EBE600C5A870 /* FetchFeedListUseCase.swift in Sources */, 1D1283A82C15EABB00C5A870 /* Comment.swift in Sources */, + 1D1283C82C16CE7C00C5A870 /* DateFormatter+Extensions.swift in Sources */, + 1D1283B82C169C0200C5A870 /* FeedListRepository.swift in Sources */, 1D1283A42C15EA8100C5A870 /* RecipeType.swift in Sources */, 1D1283AA2C15EBCF00C5A870 /* SearchFeedUseCase.swift in Sources */, 1D2C16E82BE532B700C04508 /* SceneDelegate.swift in Sources */, + 1D1283BA2C16A62800C5A870 /* SearchFeedListRepository.swift in Sources */, 1D1283A22C15E94300C5A870 /* Recipe.swift in Sources */, + 1D1283CA2C16D9C600C5A870 /* RecipeFetchService.swift in Sources */, + 1D1283C32C16B06F00C5A870 /* UserDTO.swift in Sources */, + 1D1283C12C16B05800C5A870 /* RecipeDTO.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -657,6 +748,29 @@ }; }; /* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1D1283AE2C1697DB00C5A870 /* RxCocoa */ = { + isa = XCSwiftPackageProductDependency; + package = 1D740B3F2C15E1EC0001B704 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxCocoa; + }; + 1D1283B02C1697DB00C5A870 /* RxSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 1D740B3F2C15E1EC0001B704 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxSwift; + }; + 1D1283B32C16983900C5A870 /* RxSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 1D740B3F2C15E1EC0001B704 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxSwift; + }; + 1D1283B52C16984E00C5A870 /* RxCocoa */ = { + isa = XCSwiftPackageProductDependency; + package = 1D740B3F2C15E1EC0001B704 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxCocoa; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 1D2C16DA2BE532B700C04508 /* Project object */; } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift new file mode 100644 index 0000000..db17468 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift @@ -0,0 +1,30 @@ +// +// FetchFeedListUseCase.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/9/24. +// + +import RxSwift + +protocol FetchFeedListUseCase { + func execute() -> Observable> +} + +class DefaultFetchFeedListUseCase: FetchFeedListUseCase { + private let repository: FeedListRepository + + init(repository: FeedListRepository) { + self.repository = repository + } + + func execute() -> Observable> { + return repository.fetchRecipes() + .map { recipes in + return .success(recipes) + } + .catch { error in + return .just(.failure(error)) + } + } +} diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift new file mode 100644 index 0000000..aec4bb1 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift @@ -0,0 +1,30 @@ +// +// SearchFeedUseCase.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/9/24. +// + +import RxSwift + +protocol SearchFeedListUseCase { + func execute(title: String) -> Observable> +} + +class DefaultSearchFeedListUseCase: SearchFeedListUseCase { + private let repository: SearchFeedListRepository + + init(repository: SearchFeedListRepository) { + self.repository = repository + } + + func execute(title: String) -> Observable> { + return repository.searchRecipes(title: title) + .map { recipes in + return .success(recipes) + } + .catch { error in + return .just(.failure(error)) + } + } +} From 5fcb880a73ca9a6e5eecbfd85875af432516c98e Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Mon, 10 Jun 2024 16:58:42 +0900 Subject: [PATCH 03/16] =?UTF-8?q?Feat:=20FeedListRepository,SearchFeedList?= =?UTF-8?q?Repository=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/FeedListRepository.swift | 24 ++++++++++++++++++ .../SearchFeedListRepository.swift | 25 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift new file mode 100644 index 0000000..6a4856f --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift @@ -0,0 +1,24 @@ +// +// FeedListRepository.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/10/24. +// + +import RxSwift + +protocol FeedListRepository { + func fetchRecipes() -> Observable<[Recipe]> +} + +class DefaultFeedListRepository: FeedListRepository { + private let networkService: RecipeFetchService + + init(networkService: RecipeFetchService) { + self.networkService = networkService + } + + func fetchRecipes() -> Observable<[Recipe]> { + return networkService.fetchRecipes() + } +} diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift new file mode 100644 index 0000000..57b76e2 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift @@ -0,0 +1,25 @@ +// +// SearchFeedListRepository.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/10/24. +// + +import RxSwift + +protocol SearchFeedListRepository { + func searchRecipes(title: String) -> Observable<[Recipe]> +} + +class DefaultSearchFeedRepository: SearchFeedListRepository { + + private let networkService: RecipeFetchService + + init(networkService: RecipeFetchService) { + self.networkService = networkService + } + + func searchRecipes(title: String) -> Observable<[Recipe]> { + return networkService.searchRecipes(title: title) + } +} From e9d4af2cb4fb46ea4507d929513246ffa9a64ea6 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Mon, 10 Jun 2024 17:44:47 +0900 Subject: [PATCH 04/16] =?UTF-8?q?Feat:=20RecipeDTO=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Network/DTO/RecipeDTO.swift | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift new file mode 100644 index 0000000..5cf8bff --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift @@ -0,0 +1,48 @@ +// +// RecipeDTO.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/10/24. +// + +import Foundation + +struct RecipesResponseDTO: Decodable { + let statusCode: Int + let message: String + let data: [RecipeDTO] +} + +struct RecipeDTO: Decodable { + let recipeId: Int + let recipeType: String + let recipeName: String + let recipeDescription: String + let recipeLikesCnt: Int + let createdAt: String + let writer: UserDTO + let recipeImgUrls: [RecipeImageDTO] +} + +struct RecipeImageDTO: Decodable { + let recipeImgId: Int + let recipeImgUrl: String +} + +extension RecipeDTO { + func toDomain() -> Recipe { + return Recipe( + id: recipeId, + type: RecipeType(rawValue: recipeType) ?? .dessert, + name: recipeName, + description: recipeDescription, + writer: writer.toDomain(), + imageUrls: recipeImgUrls.map { $0.recipeImgUrl }, + isLiked: false, + likeCount: recipeLikesCnt, + createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() + ) + } +} + + From 56c5ae6d87a8844895fcc1cb4a0d52bcc189d98a Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 15:31:16 +0900 Subject: [PATCH 05/16] =?UTF-8?q?Fix:=20=EC=9D=B4=EB=AF=B8=EC=A7=80DTO=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC,=20=EB=A0=88=EC=8B=9C=ED=94=BCDTO=20prefix?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20id=20ID=EB=A1=9C=20=EB=B3=80=EA=B2=BD,=20t?= =?UTF-8?q?ype=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20coffee=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Network/DTO/RecipeDTO.swift | 49 +++++++++---------- .../Data/Network/DTO/RecipeImageDTO.swift | 13 +++++ 2 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift index 5cf8bff..21705cb 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift @@ -7,42 +7,41 @@ import Foundation -struct RecipesResponseDTO: Decodable { - let statusCode: Int - let message: String - let data: [RecipeDTO] -} - struct RecipeDTO: Decodable { - let recipeId: Int - let recipeType: String - let recipeName: String - let recipeDescription: String - let recipeLikesCnt: Int + + let ID: Int + let type: String + let name: String + let description: String + let likesCount: Int let createdAt: String let writer: UserDTO - let recipeImgUrls: [RecipeImageDTO] -} - -struct RecipeImageDTO: Decodable { - let recipeImgId: Int - let recipeImgUrl: String + let imageUrls: [RecipeImageDTO] + + enum CodingKeys: String, CodingKey { + case ID = "recipeId" + case type = "recipeType" + case name = "recipeName" + case description = "recipeDescription" + case likesCount = "recipeLikesCnt" + case createdAt = "createdAt" + case writer = "writer" + case imageUrls = "recipeImgUrls" + } } extension RecipeDTO { func toDomain() -> Recipe { return Recipe( - id: recipeId, - type: RecipeType(rawValue: recipeType) ?? .dessert, - name: recipeName, - description: recipeDescription, + id: ID, + type: RecipeType(rawValue: type) ?? .coffee, + name: name, + description: description, writer: writer.toDomain(), - imageUrls: recipeImgUrls.map { $0.recipeImgUrl }, + imageUrls: imageUrls.map { $0.recipeImgUrl }, isLiked: false, - likeCount: recipeLikesCnt, + likeCount: likesCount, createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() ) } } - - diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift new file mode 100644 index 0000000..418a5d4 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift @@ -0,0 +1,13 @@ +// +// RecipeImageDTO.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/11/24. +// + +import Foundation + +struct RecipeImageDTO: Decodable { + let recipeImgId: Int + let recipeImgUrl: String +} From 8afc27bff65feaff7d6fedf630a9d46cea07880b Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 15:34:22 +0900 Subject: [PATCH 06/16] =?UTF-8?q?Fix:=20RecipesResponseDTO=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Network/RecipesResponseDTO.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift new file mode 100644 index 0000000..8bb53a6 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift @@ -0,0 +1,14 @@ +// +// RecipesResponseDTO.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/11/24. +// + +import Foundation + +struct RecipesResponseDTO: Decodable { + let statusCode: Int + let message: String + let data: [RecipeDTO] +} From d86703ca15548f8d9a8b938f952f97c2fffa6268 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 18:11:42 +0900 Subject: [PATCH 07/16] =?UTF-8?q?Fix:=20ResponseDTO=EB=A1=9C=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD,=20DTO=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Network/{RecipesResponseDTO.swift => DTO/ResponseDTO.swift} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename HomeCafeRecipes/HomeCafeRecipes/Data/Network/{RecipesResponseDTO.swift => DTO/ResponseDTO.swift} (83%) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift similarity index 83% rename from HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift rename to HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift index 8bb53a6..05b1da2 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/RecipesResponseDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift @@ -7,7 +7,7 @@ import Foundation -struct RecipesResponseDTO: Decodable { +struct ResponseDTO: Decodable { let statusCode: Int let message: String let data: [RecipeDTO] From 628e0b776bccdf7fd157b61df0aa78a829572fdc Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 18:21:46 +0900 Subject: [PATCH 08/16] =?UTF-8?q?Fix:=20img=EB=A5=BC=20Image=20=EC=A4=84?= =?UTF-8?q?=EC=9E=84=EB=A7=90=20=EB=B3=80=EA=B2=BD,=20recipeImageID?= =?UTF-8?q?=EB=A1=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD,?= =?UTF-8?q?=20ID=EB=A5=BC=20id=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift | 8 ++++---- .../HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift index 21705cb..bbd8d06 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift @@ -9,7 +9,7 @@ import Foundation struct RecipeDTO: Decodable { - let ID: Int + let id: Int let type: String let name: String let description: String @@ -19,7 +19,7 @@ struct RecipeDTO: Decodable { let imageUrls: [RecipeImageDTO] enum CodingKeys: String, CodingKey { - case ID = "recipeId" + case id = "recipeId" case type = "recipeType" case name = "recipeName" case description = "recipeDescription" @@ -33,12 +33,12 @@ struct RecipeDTO: Decodable { extension RecipeDTO { func toDomain() -> Recipe { return Recipe( - id: ID, + id: id, type: RecipeType(rawValue: type) ?? .coffee, name: name, description: description, writer: writer.toDomain(), - imageUrls: imageUrls.map { $0.recipeImgUrl }, + imageUrls: imageUrls.map { $0.recipeImageUrl }, isLiked: false, likeCount: likesCount, createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift index 418a5d4..393a863 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift @@ -8,6 +8,6 @@ import Foundation struct RecipeImageDTO: Decodable { - let recipeImgId: Int - let recipeImgUrl: String + let recipeImageID: Int + let recipeImageUrl: String } From a7e58be72ddfe1734dc540d307f26c7d5f02f835 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 22:53:07 +0900 Subject: [PATCH 09/16] =?UTF-8?q?Fix:=20Observable=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=8B=A8=EC=9D=BC=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=97=90=20=EB=8D=94=20=EC=A0=81=ED=95=A9=ED=95=9C=20?= =?UTF-8?q?Single=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Repositories/FeedListRepository.swift | 4 ++-- .../Data/Repositories/SearchFeedListRepository.swift | 4 ++-- .../Domain/UseCases/FetchFeedListUseCase.swift | 4 ++-- .../HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift index 6a4856f..28c1eec 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift @@ -8,7 +8,7 @@ import RxSwift protocol FeedListRepository { - func fetchRecipes() -> Observable<[Recipe]> + func fetchRecipes() -> Single<[Recipe]> } class DefaultFeedListRepository: FeedListRepository { @@ -18,7 +18,7 @@ class DefaultFeedListRepository: FeedListRepository { self.networkService = networkService } - func fetchRecipes() -> Observable<[Recipe]> { + func fetchRecipes() -> Single<[Recipe]> { return networkService.fetchRecipes() } } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift index 57b76e2..a158f62 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift @@ -8,7 +8,7 @@ import RxSwift protocol SearchFeedListRepository { - func searchRecipes(title: String) -> Observable<[Recipe]> + func searchRecipes(title: String) -> Single<[Recipe]> } class DefaultSearchFeedRepository: SearchFeedListRepository { @@ -19,7 +19,7 @@ class DefaultSearchFeedRepository: SearchFeedListRepository { self.networkService = networkService } - func searchRecipes(title: String) -> Observable<[Recipe]> { + func searchRecipes(title: String) -> Single<[Recipe]> { return networkService.searchRecipes(title: title) } } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift index db17468..42bfbee 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift @@ -8,7 +8,7 @@ import RxSwift protocol FetchFeedListUseCase { - func execute() -> Observable> + func execute() -> Single> } class DefaultFetchFeedListUseCase: FetchFeedListUseCase { @@ -18,7 +18,7 @@ class DefaultFetchFeedListUseCase: FetchFeedListUseCase { self.repository = repository } - func execute() -> Observable> { + func execute() -> Single> { return repository.fetchRecipes() .map { recipes in return .success(recipes) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift index aec4bb1..37715b8 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift @@ -8,7 +8,7 @@ import RxSwift protocol SearchFeedListUseCase { - func execute(title: String) -> Observable> + func execute(title: String) -> Single> } class DefaultSearchFeedListUseCase: SearchFeedListUseCase { @@ -18,7 +18,7 @@ class DefaultSearchFeedListUseCase: SearchFeedListUseCase { self.repository = repository } - func execute(title: String) -> Observable> { + func execute(title: String) -> Single> { return repository.searchRecipes(title: title) .map { recipes in return .success(recipes) From bf60bc607d0361ad91dc1c53b228255d682d072f Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 22:59:24 +0900 Subject: [PATCH 10/16] =?UTF-8?q?Fix:=20isLiked=EB=A5=BC=20hasBeenLiked?= =?UTF-8?q?=EB=A1=9C=20=EC=A2=80=20=EB=8D=94=20=EB=AA=85=ED=99=95=ED=9E=88?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift | 2 +- HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift index bbd8d06..3e31dc9 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift @@ -39,7 +39,7 @@ extension RecipeDTO { description: description, writer: writer.toDomain(), imageUrls: imageUrls.map { $0.recipeImageUrl }, - isLiked: false, + hasBeenLiked: false, likeCount: likesCount, createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() ) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift index 696ce78..5a0da65 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift @@ -14,7 +14,7 @@ struct Recipe { let description: String let writer: User let imageUrls: [String] - let isLiked: Bool + let hasBeenLiked: Bool let likeCount: Int let createdAt: Date } From 84df58b080c31c9891ac881e81428265c4fd5712 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Tue, 11 Jun 2024 23:00:08 +0900 Subject: [PATCH 11/16] =?UTF-8?q?Fix:=20ResponseDTO=EB=A5=BC=20NetworkResp?= =?UTF-8?q?onseDTO=EB=A1=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Network/DTO/{ResponseDTO.swift => NetworkResponseDTO.swift} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/{ResponseDTO.swift => NetworkResponseDTO.swift} (83%) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift similarity index 83% rename from HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift rename to HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift index 05b1da2..4f0a0ee 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/ResponseDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift @@ -7,7 +7,7 @@ import Foundation -struct ResponseDTO: Decodable { +struct NetworkResponseDTO: Decodable { let statusCode: Int let message: String let data: [RecipeDTO] From 506be99e2b8d5b68471b39b4e68b120586ad4025 Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Wed, 12 Jun 2024 14:43:00 +0900 Subject: [PATCH 12/16] =?UTF-8?q?Fix:=20RecipeImageDTO=EC=97=90=20CodingKe?= =?UTF-8?q?ys=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift index 393a863..bb5cdea 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeImageDTO.swift @@ -10,4 +10,9 @@ import Foundation struct RecipeImageDTO: Decodable { let recipeImageID: Int let recipeImageUrl: String + + private enum CodingKeys: String, CodingKey { + case recipeImageID = "recipeImgId" + case recipeImageUrl = "recipeImgUrl" + } } From 8acf4c6c1d942a10baede36c0beb5ca5bf9568fb Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Wed, 12 Jun 2024 18:02:54 +0900 Subject: [PATCH 13/16] =?UTF-8?q?Fix:=20pagination=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=B4=20DTO=EA=B5=AC=EC=A1=B0=EB=A5=BC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Network/DTO/NetworkResponseDTO.swift | 4 ++-- .../Data/Network/DTO/RecipePageDTO.swift | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipePageDTO.swift diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift index 4f0a0ee..2399978 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/NetworkResponseDTO.swift @@ -7,8 +7,8 @@ import Foundation -struct NetworkResponseDTO: Decodable { +struct NetworkResponseDTO: Decodable { let statusCode: Int let message: String - let data: [RecipeDTO] + let data: T } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipePageDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipePageDTO.swift new file mode 100644 index 0000000..7a72985 --- /dev/null +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipePageDTO.swift @@ -0,0 +1,20 @@ +// +// RecipePageDTO.swift +// HomeCafeRecipes +// +// Created by 김건호 on 6/12/24. +// + +import Foundation + +struct RecipePageDTO: Decodable { + let totalPageNumber: Int + let pageNumber: Int + let recipes: [RecipeDTO] + + private enum CodingKeys: String, CodingKey { + case totalPageNumber = "totalPageNumber" + case pageNumber = "pageNumber" + case recipes = "recipes" + } +} From 66312f1c0cfd3f70e7c27dde1f1e2b8847a3561f Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Wed, 12 Jun 2024 18:03:45 +0900 Subject: [PATCH 14/16] =?UTF-8?q?Fix:=20pagination=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20FeedListRepository,SearchFeedListRepositor?= =?UTF-8?q?y=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Repositories/FeedListRepository.swift | 6 +++--- .../Data/Repositories/SearchFeedListRepository.swift | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift index 28c1eec..2fda774 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/FeedListRepository.swift @@ -8,7 +8,7 @@ import RxSwift protocol FeedListRepository { - func fetchRecipes() -> Single<[Recipe]> + func fetchRecipes(pageNumber: Int) -> Single<[Recipe]> } class DefaultFeedListRepository: FeedListRepository { @@ -18,7 +18,7 @@ class DefaultFeedListRepository: FeedListRepository { self.networkService = networkService } - func fetchRecipes() -> Single<[Recipe]> { - return networkService.fetchRecipes() + func fetchRecipes(pageNumber: Int) -> Single<[Recipe]> { + return networkService.fetchRecipes(pageNumber: pageNumber) } } diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift index a158f62..6b4b21d 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Repositories/SearchFeedListRepository.swift @@ -8,7 +8,7 @@ import RxSwift protocol SearchFeedListRepository { - func searchRecipes(title: String) -> Single<[Recipe]> + func searchRecipes(title: String, pageNumber: Int) -> Single<[Recipe]> } class DefaultSearchFeedRepository: SearchFeedListRepository { @@ -19,7 +19,7 @@ class DefaultSearchFeedRepository: SearchFeedListRepository { self.networkService = networkService } - func searchRecipes(title: String) -> Single<[Recipe]> { - return networkService.searchRecipes(title: title) + func searchRecipes(title: String,pageNumber: Int) -> Single<[Recipe]> { + return networkService.searchRecipes(title: title, pageNumber: pageNumber) } } From e9763e81231e13ddd9623b1033bbe08fe8dbfc3f Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Wed, 12 Jun 2024 18:04:45 +0900 Subject: [PATCH 15/16] =?UTF-8?q?Fix:=20pagination=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=B4=20FetchFeedListUseCase,SearchFeedListUseCase=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/UseCases/FetchFeedListUseCase.swift | 8 ++++---- .../Domain/UseCases/SearchFeedUseCase.swift | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift index 42bfbee..f5b4152 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/FetchFeedListUseCase.swift @@ -8,7 +8,7 @@ import RxSwift protocol FetchFeedListUseCase { - func execute() -> Single> + func execute(pageNumber: Int) -> Single> } class DefaultFetchFeedListUseCase: FetchFeedListUseCase { @@ -18,9 +18,9 @@ class DefaultFetchFeedListUseCase: FetchFeedListUseCase { self.repository = repository } - func execute() -> Single> { - return repository.fetchRecipes() - .map { recipes in + func execute(pageNumber: Int) -> Single> { + return repository.fetchRecipes(pageNumber: pageNumber) + .map { recipes in return .success(recipes) } .catch { error in diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift index 37715b8..68fd1c3 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/UseCases/SearchFeedUseCase.swift @@ -8,7 +8,7 @@ import RxSwift protocol SearchFeedListUseCase { - func execute(title: String) -> Single> + func execute(title: String,pageNumber: Int) -> Single> } class DefaultSearchFeedListUseCase: SearchFeedListUseCase { @@ -18,8 +18,8 @@ class DefaultSearchFeedListUseCase: SearchFeedListUseCase { self.repository = repository } - func execute(title: String) -> Single> { - return repository.searchRecipes(title: title) + func execute(title: String,pageNumber: Int) -> Single> { + return repository.searchRecipes(title: title,pageNumber: pageNumber) .map { recipes in return .success(recipes) } From b7981cc5ef6cd32ea7dafd8f1789d90c86443fac Mon Sep 17 00:00:00 2001 From: GeonH0 Date: Wed, 12 Jun 2024 23:56:29 +0900 Subject: [PATCH 16/16] =?UTF-8?q?Fix:=20hasBeenLiked=EB=A5=BC=20isLikedByC?= =?UTF-8?q?urrentUser=EB=A1=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift | 4 +++- HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift index 3e31dc9..6f1d198 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Data/Network/DTO/RecipeDTO.swift @@ -17,6 +17,7 @@ struct RecipeDTO: Decodable { let createdAt: String let writer: UserDTO let imageUrls: [RecipeImageDTO] + let isLikedByCurrentUser: Bool enum CodingKeys: String, CodingKey { case id = "recipeId" @@ -27,6 +28,7 @@ struct RecipeDTO: Decodable { case createdAt = "createdAt" case writer = "writer" case imageUrls = "recipeImgUrls" + case isLikedByCurrentUser = "isLiked" } } @@ -39,7 +41,7 @@ extension RecipeDTO { description: description, writer: writer.toDomain(), imageUrls: imageUrls.map { $0.recipeImageUrl }, - hasBeenLiked: false, + isLikedByCurrentUser: isLikedByCurrentUser, likeCount: likesCount, createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() ) diff --git a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift index 5a0da65..06e9520 100644 --- a/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift +++ b/HomeCafeRecipes/HomeCafeRecipes/Domain/Entities/Recipe.swift @@ -14,7 +14,7 @@ struct Recipe { let description: String let writer: User let imageUrls: [String] - let hasBeenLiked: Bool + let isLikedByCurrentUser: Bool let likeCount: Int let createdAt: Date }