From 94b09e67f784fdd498835a1ddf7c012dbab87649 Mon Sep 17 00:00:00 2001 From: Hamp Date: Sat, 9 Dec 2023 00:21:29 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20::=20=20qna=20->=20Faq=20=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Application/AppComponent+Faq.swift | 52 ++++++++++ .../Application/AppComponent+Qna.swift | 52 ---------- .../Sources/Application/NeedleGenerated.swift | 95 ++++++++----------- .../Resources/Storage.storyboard | 22 ++--- .../Sources/Components/FaqComponent.swift | 27 ++++++ ...ponent.swift => FaqContentComponent.swift} | 9 +- .../Sources/Components/QnaComponent.swift | 27 ------ .../Sources/Components/RequestComponent.swift | 4 +- ...r.swift => FaqContentViewController.swift} | 12 +-- ...ntroller.swift => FaqViewController.swift} | 26 ++--- .../RequestViewController.swift | 8 +- ...{QnaViewModel.swift => FaqViewModel.swift} | 29 +++--- .../ViewModels/QnaContentViewModel.swift | 4 +- .../Sources/Views/AnswerTableViewCell.swift | 2 +- .../Sources/Views/QuestionTableViewCell.swift | 2 +- .../API/{QnaAPI.swift => FaqAPI.swift} | 20 ++-- .../Services/APIKit/Sources/API/WMAPI.swift | 4 +- .../Faq/Response/FaqCategoryResponseDTO.swift | 5 + .../Sources/Faq/Response/FaqResponseDTO.swift | 20 ++++ .../Qna/Response/QnaCategoryResponseDTO.swift | 5 - .../Sources/Qna/Response/QnaResponseDTO.swift | 26 ----- .../Faq/Repositories/FaqRepositoryImpl.swift | 35 +++++++ .../FetchFaqCategoriesUseCaseImpl.swift} | 12 +-- .../UseCases/FetchFaqUseCaseImpl.swift} | 12 +-- .../Qna/Repositories/QnaRepositoryImpl.swift | 35 ------- .../Faq/Entity/FaqCategoryEntity.swift | 10 ++ .../Entity/FaqEntity.swift} | 5 +- .../Repository/FaqRepository.swift} | 6 +- .../UseCase/FetchFaqCategoriesUseCase.swift} | 4 +- .../UseCase/FetchFaqUseCase.swift} | 4 +- .../Qna/Entity/QnaCategoryEntity.swift | 10 -- .../FetchCategoriesTransfer.swift | 12 +++ .../DataTransfer/FetchQnaTransfer.swift | 9 +- .../Faq/Remote/RemoteFaqDataSource.swift | 10 ++ .../Faq/Remote/RemoteFaqDataSourceImpl.swift | 21 ++++ .../FetchCategoriesTransfer.swift | 12 --- .../Qna/Remote/RemoteQnaDataSource.swift | 10 -- .../Qna/Remote/RemoteQnaDataSourceImpl.swift | 21 ---- 38 files changed, 327 insertions(+), 352 deletions(-) create mode 100644 Projects/App/Sources/Application/AppComponent+Faq.swift delete mode 100644 Projects/App/Sources/Application/AppComponent+Qna.swift create mode 100644 Projects/Features/StorageFeature/Sources/Components/FaqComponent.swift rename Projects/Features/StorageFeature/Sources/Components/{QnaContentComponent.swift => FaqContentComponent.swift} (51%) delete mode 100644 Projects/Features/StorageFeature/Sources/Components/QnaComponent.swift rename Projects/Features/StorageFeature/Sources/ViewControllers/{QnaContentViewController.swift => FaqContentViewController.swift} (92%) rename Projects/Features/StorageFeature/Sources/ViewControllers/{QnaViewController.swift => FaqViewController.swift} (85%) rename Projects/Features/StorageFeature/Sources/ViewModels/{QnaViewModel.swift => FaqViewModel.swift} (51%) rename Projects/Services/APIKit/Sources/API/{QnaAPI.swift => FaqAPI.swift} (75%) create mode 100644 Projects/Services/DataMappingModule/Sources/Faq/Response/FaqCategoryResponseDTO.swift create mode 100644 Projects/Services/DataMappingModule/Sources/Faq/Response/FaqResponseDTO.swift delete mode 100644 Projects/Services/DataMappingModule/Sources/Qna/Response/QnaCategoryResponseDTO.swift delete mode 100644 Projects/Services/DataMappingModule/Sources/Qna/Response/QnaResponseDTO.swift create mode 100644 Projects/Services/DataModule/Sources/Faq/Repositories/FaqRepositoryImpl.swift rename Projects/Services/DataModule/Sources/{Qna/UseCases/FetchQnaCategoriesUseCaseImpl.swift => Faq/UseCases/FetchFaqCategoriesUseCaseImpl.swift} (51%) rename Projects/Services/DataModule/Sources/{Qna/UseCases/FetchQnaUseCaseImpl.swift => Faq/UseCases/FetchFaqUseCaseImpl.swift} (53%) delete mode 100644 Projects/Services/DataModule/Sources/Qna/Repositories/QnaRepositoryImpl.swift create mode 100644 Projects/Services/DomainModule/Sources/Faq/Entity/FaqCategoryEntity.swift rename Projects/Services/DomainModule/Sources/{Qna/Entity/QnaEntity.swift => Faq/Entity/FaqEntity.swift} (74%) rename Projects/Services/DomainModule/Sources/{Qna/Repository/QnaRepository.swift => Faq/Repository/FaqRepository.swift} (62%) rename Projects/Services/DomainModule/Sources/{Qna/UseCase/FetchQnaCategoriesUseCase.swift => Faq/UseCase/FetchFaqCategoriesUseCase.swift} (69%) rename Projects/Services/DomainModule/Sources/{Qna/UseCase/FetchQnaUseCase.swift => Faq/UseCase/FetchFaqUseCase.swift} (73%) delete mode 100644 Projects/Services/DomainModule/Sources/Qna/Entity/QnaCategoryEntity.swift create mode 100644 Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchCategoriesTransfer.swift rename Projects/Services/NetworkModule/Sources/{Qna => Faq}/DataTransfer/FetchQnaTransfer.swift (51%) create mode 100644 Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSource.swift create mode 100644 Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSourceImpl.swift delete mode 100644 Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchCategoriesTransfer.swift delete mode 100644 Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSource.swift delete mode 100644 Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSourceImpl.swift diff --git a/Projects/App/Sources/Application/AppComponent+Faq.swift b/Projects/App/Sources/Application/AppComponent+Faq.swift new file mode 100644 index 000000000..222cec8ed --- /dev/null +++ b/Projects/App/Sources/Application/AppComponent+Faq.swift @@ -0,0 +1,52 @@ +// +// AppComponent+Search.swift +// WaktaverseMusic +// +// Created by yongbeomkwak on 2023/02/07. +// Copyright © 2023 yongbeomkwak. All rights reserved. +// + +import DomainModule +import DataModule +import NetworkModule +import CommonFeature +import SignInFeature +import StorageFeature + +//MARK: 변수명 주의 +// AppComponent 내 변수 == Dependency 내 변수 이름 같아야함 + + +public extension AppComponent { + var faqComponent: FaqComponent { + FaqComponent(parent: self) + } + + var faqContentComponent: FaqContentComponent { + FaqContentComponent(parent: self) + } + + var remoteFaqDataSource: any RemoteFaqDataSource { + shared { + RemoteFaqDataSourceImpl(keychain: keychain) + } + } + + var faqRepository: any FaqRepository { + shared { + FaqRepositoryImpl(remoteFaqDataSource: remoteFaqDataSource) + } + } + + var fetchFaqCategoriesUseCase: any FetchFaqCategoriesUseCase{ + shared { + FetchFaqCategoriesUseCaseImpl(faqRepository: faqRepository) + } + } + + var fetchFaqUseCase: any FetchFaqUseCase { + shared { + FetchFaqUseCaseImpl(faqRepository: faqRepository) + } + } +} diff --git a/Projects/App/Sources/Application/AppComponent+Qna.swift b/Projects/App/Sources/Application/AppComponent+Qna.swift deleted file mode 100644 index 1c7399530..000000000 --- a/Projects/App/Sources/Application/AppComponent+Qna.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// AppComponent+Search.swift -// WaktaverseMusic -// -// Created by yongbeomkwak on 2023/02/07. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import DomainModule -import DataModule -import NetworkModule -import CommonFeature -import SignInFeature -import StorageFeature - -//MARK: 변수명 주의 -// AppComponent 내 변수 == Dependency 내 변수 이름 같아야함 - - -public extension AppComponent { - var qnaComponent: QnaComponent { - QnaComponent(parent: self) - } - - var qnaContentComponent: QnaContentComponent { - QnaContentComponent(parent: self) - } - - var remoteQnaDataSource: any RemoteQnaDataSource { - shared { - RemoteQnaDataSourceImpl(keychain: keychain) - } - } - - var qnaRepository: any QnaRepository { - shared { - QnaRepositoryImpl(remoteQnaDataSource: remoteQnaDataSource) - } - } - - var fetchQnaCategoriesUseCase: any FetchQnaCategoriesUseCase{ - shared { - FetchQnaCategoriesUseCaseImpl(qnaRepository: qnaRepository) - } - } - - var fetchQnaUseCase: any FetchQnaUseCase { - shared { - FetchQnaUseCaseImpl(qnaRepository: qnaRepository) - } - } -} diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index dff4425c8..809ccfc32 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -286,6 +286,25 @@ private class StorageDependency1447167c38e97ef97427Provider: StorageDependency { private func factory2415399d25299b97b98bf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return StorageDependency1447167c38e97ef97427Provider(appComponent: parent1(component) as! AppComponent) } +private class FaqDependency899aad15f17210a3af31Provider: FaqDependency { + var faqContentComponent: FaqContentComponent { + return appComponent.faqContentComponent + } + var fetchFaqCategoriesUseCase: any FetchFaqCategoriesUseCase { + return appComponent.fetchFaqCategoriesUseCase + } + var fetchFaqUseCase: any FetchFaqUseCase { + return appComponent.fetchFaqUseCase + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent + } +} +/// ^->AppComponent->FaqComponent +private func factory4e13cc6545633ffc2ed5f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return FaqDependency899aad15f17210a3af31Provider(appComponent: parent1(component) as! AppComponent) +} private class QuestionDependencyf7010567c2d88e76d191Provider: QuestionDependency { var suggestFunctionComponent: SuggestFunctionComponent { return appComponent.suggestFunctionComponent @@ -383,31 +402,12 @@ private class FavoriteDependency8f7fd37aeb6f0e5d0e30Provider: FavoriteDependency private func factory8e4acb90bd0d9b48604af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return FavoriteDependency8f7fd37aeb6f0e5d0e30Provider(appComponent: parent1(component) as! AppComponent) } -private class QnaDependencybc3f0a2d4f873ad1b160Provider: QnaDependency { - var qnaContentComponent: QnaContentComponent { - return appComponent.qnaContentComponent - } - var fetchQnaCategoriesUseCase: any FetchQnaCategoriesUseCase { - return appComponent.fetchQnaCategoriesUseCase - } - var fetchQnaUseCase: any FetchQnaUseCase { - return appComponent.fetchQnaUseCase - } - private let appComponent: AppComponent - init(appComponent: AppComponent) { - self.appComponent = appComponent - } -} -/// ^->AppComponent->QnaComponent -private func factory49a98666675cb7a82038f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { - return QnaDependencybc3f0a2d4f873ad1b160Provider(appComponent: parent1(component) as! AppComponent) -} private class RequestDependencyd4f6f0030dbf2a90cf21Provider: RequestDependency { var withdrawUserInfoUseCase: any WithdrawUserInfoUseCase { return appComponent.withdrawUserInfoUseCase } - var qnaComponent: QnaComponent { - return appComponent.qnaComponent + var faqComponent: FaqComponent { + return appComponent.faqComponent } var questionComponent: QuestionComponent { return appComponent.questionComponent @@ -457,17 +457,6 @@ private class NoticeDependencyaec92ef53617a421bdf3Provider: NoticeDependency { private func factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return NoticeDependencyaec92ef53617a421bdf3Provider(appComponent: parent1(component) as! AppComponent) } -private class QnaContentDependency68ed55648233d525d265Provider: QnaContentDependency { - - - init() { - - } -} -/// ^->AppComponent->QnaContentComponent -private func factory1501f7005831c8411229e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { - return QnaContentDependency68ed55648233d525d265Provider() -} private class BugReportDependencyeea5818852f336c35729Provider: BugReportDependency { var reportBugUseCase: any ReportBugUseCase { return appComponent.reportBugUseCase @@ -868,12 +857,6 @@ extension AppComponent: Registration { localTable["noticeRepository-any NoticeRepository"] = { [unowned self] in self.noticeRepository as Any } localTable["fetchNoticeUseCase-any FetchNoticeUseCase"] = { [unowned self] in self.fetchNoticeUseCase as Any } localTable["fetchNoticeCategoriesUseCase-any FetchNoticeCategoriesUseCase"] = { [unowned self] in self.fetchNoticeCategoriesUseCase as Any } - localTable["qnaComponent-QnaComponent"] = { [unowned self] in self.qnaComponent as Any } - localTable["qnaContentComponent-QnaContentComponent"] = { [unowned self] in self.qnaContentComponent as Any } - localTable["remoteQnaDataSource-any RemoteQnaDataSource"] = { [unowned self] in self.remoteQnaDataSource as Any } - localTable["qnaRepository-any QnaRepository"] = { [unowned self] in self.qnaRepository as Any } - localTable["fetchQnaCategoriesUseCase-any FetchQnaCategoriesUseCase"] = { [unowned self] in self.fetchQnaCategoriesUseCase as Any } - localTable["fetchQnaUseCase-any FetchQnaUseCase"] = { [unowned self] in self.fetchQnaUseCase as Any } localTable["questionComponent-QuestionComponent"] = { [unowned self] in self.questionComponent as Any } localTable["suggestFunctionComponent-SuggestFunctionComponent"] = { [unowned self] in self.suggestFunctionComponent as Any } localTable["wakMusicFeedbackComponent-WakMusicFeedbackComponent"] = { [unowned self] in self.wakMusicFeedbackComponent as Any } @@ -885,6 +868,12 @@ extension AppComponent: Registration { localTable["suggestFunctionUseCase-any SuggestFunctionUseCase"] = { [unowned self] in self.suggestFunctionUseCase as Any } localTable["modifySongUseCase-any ModifySongUseCase"] = { [unowned self] in self.modifySongUseCase as Any } localTable["inquiryWeeklyChartUseCase-any InquiryWeeklyChartUseCase"] = { [unowned self] in self.inquiryWeeklyChartUseCase as Any } + localTable["faqComponent-FaqComponent"] = { [unowned self] in self.faqComponent as Any } + localTable["faqContentComponent-FaqContentComponent"] = { [unowned self] in self.faqContentComponent as Any } + localTable["remoteFaqDataSource-any RemoteFaqDataSource"] = { [unowned self] in self.remoteFaqDataSource as Any } + localTable["faqRepository-any FaqRepository"] = { [unowned self] in self.faqRepository as Any } + localTable["fetchFaqCategoriesUseCase-any FetchFaqCategoriesUseCase"] = { [unowned self] in self.fetchFaqCategoriesUseCase as Any } + localTable["fetchFaqUseCase-any FetchFaqUseCase"] = { [unowned self] in self.fetchFaqUseCase as Any } localTable["remoteAppDataSource-any RemoteAppDataSource"] = { [unowned self] in self.remoteAppDataSource as Any } localTable["appRepository-any AppRepository"] = { [unowned self] in self.appRepository as Any } localTable["fetchCheckAppUseCase-any FetchCheckAppUseCase"] = { [unowned self] in self.fetchCheckAppUseCase as Any } @@ -988,6 +977,13 @@ extension StorageComponent: Registration { keyPathToName[\StorageDependency.afterLoginComponent] = "afterLoginComponent-AfterLoginComponent" } } +extension FaqComponent: Registration { + public func registerItems() { + keyPathToName[\FaqDependency.faqContentComponent] = "faqContentComponent-FaqContentComponent" + keyPathToName[\FaqDependency.fetchFaqCategoriesUseCase] = "fetchFaqCategoriesUseCase-any FetchFaqCategoriesUseCase" + keyPathToName[\FaqDependency.fetchFaqUseCase] = "fetchFaqUseCase-any FetchFaqUseCase" + } +} extension QuestionComponent: Registration { public func registerItems() { keyPathToName[\QuestionDependency.suggestFunctionComponent] = "suggestFunctionComponent-SuggestFunctionComponent" @@ -1023,17 +1019,10 @@ extension FavoriteComponent: Registration { keyPathToName[\FavoriteDependency.deleteFavoriteListUseCase] = "deleteFavoriteListUseCase-any DeleteFavoriteListUseCase" } } -extension QnaComponent: Registration { - public func registerItems() { - keyPathToName[\QnaDependency.qnaContentComponent] = "qnaContentComponent-QnaContentComponent" - keyPathToName[\QnaDependency.fetchQnaCategoriesUseCase] = "fetchQnaCategoriesUseCase-any FetchQnaCategoriesUseCase" - keyPathToName[\QnaDependency.fetchQnaUseCase] = "fetchQnaUseCase-any FetchQnaUseCase" - } -} extension RequestComponent: Registration { public func registerItems() { keyPathToName[\RequestDependency.withdrawUserInfoUseCase] = "withdrawUserInfoUseCase-any WithdrawUserInfoUseCase" - keyPathToName[\RequestDependency.qnaComponent] = "qnaComponent-QnaComponent" + keyPathToName[\RequestDependency.faqComponent] = "faqComponent-FaqComponent" keyPathToName[\RequestDependency.questionComponent] = "questionComponent-QuestionComponent" keyPathToName[\RequestDependency.containSongsComponent] = "containSongsComponent-ContainSongsComponent" keyPathToName[\RequestDependency.noticeComponent] = "noticeComponent-NoticeComponent" @@ -1051,11 +1040,6 @@ extension NoticeComponent: Registration { keyPathToName[\NoticeDependency.noticeDetailComponent] = "noticeDetailComponent-NoticeDetailComponent" } } -extension QnaContentComponent: Registration { - public func registerItems() { - - } -} extension BugReportComponent: Registration { public func registerItems() { keyPathToName[\BugReportDependency.reportBugUseCase] = "reportBugUseCase-any ReportBugUseCase" @@ -1066,6 +1050,11 @@ extension WakMusicFeedbackComponent: Registration { keyPathToName[\WakMusicFeedbackDependency.inquiryWeeklyChartUseCase] = "inquiryWeeklyChartUseCase-any InquiryWeeklyChartUseCase" } } +extension FaqContentComponent: Registration { + public func registerItems() { + + } +} extension RootComponent: Registration { public func registerItems() { keyPathToName[\RootDependency.mainContainerComponent] = "mainContainerComponent-MainContainerComponent" @@ -1207,17 +1196,17 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi registerProviderFactory("^->AppComponent->AskSongComponent", factory37544fa026b309cd68d7f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->SuggestFunctionComponent", factory63287bff3999ed1787ddf47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->StorageComponent", factory2415399d25299b97b98bf47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->FaqComponent", factory4e13cc6545633ffc2ed5f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->QuestionComponent", factoryedad1813a36115eec11ef47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->MyPlayListComponent", factory51a57a92f76af93a9ec2f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->AfterLoginComponent", factory6cc9c8141e04494113b8f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->FavoriteComponent", factory8e4acb90bd0d9b48604af47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->QnaComponent", factory49a98666675cb7a82038f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->RequestComponent", factory13954fb3ec537bab80bcf47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->NoticeDetailComponent", factory3db143c2f80d621d5a7fe3b0c44298fc1c149afb) registerProviderFactory("^->AppComponent->NoticeComponent", factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->QnaContentComponent", factory1501f7005831c8411229e3b0c44298fc1c149afb) registerProviderFactory("^->AppComponent->BugReportComponent", factoryafa28e93c96a785ed32af47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->WakMusicFeedbackComponent", factory32abe9db091bc43329a1f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->FaqContentComponent", factoryEmptyDependencyProvider) registerProviderFactory("^->AppComponent->RootComponent", factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->PermissionComponent", factoryc1d4d80afbccf86bf1c0e3b0c44298fc1c149afb) registerProviderFactory("^->AppComponent->SignInComponent", factoryda2925fd76da866a652af47b58f8f304c97af4d5) diff --git a/Projects/Features/StorageFeature/Resources/Storage.storyboard b/Projects/Features/StorageFeature/Resources/Storage.storyboard index 529019310..e12848ad5 100644 --- a/Projects/Features/StorageFeature/Resources/Storage.storyboard +++ b/Projects/Features/StorageFeature/Resources/Storage.storyboard @@ -1,9 +1,9 @@ - + - + @@ -519,10 +519,10 @@ - + - + @@ -594,10 +594,10 @@ - + - + @@ -730,20 +730,20 @@ - + - + - + @@ -2943,7 +2943,7 @@ - + diff --git a/Projects/Features/StorageFeature/Sources/Components/FaqComponent.swift b/Projects/Features/StorageFeature/Sources/Components/FaqComponent.swift new file mode 100644 index 000000000..ca9d5ee1b --- /dev/null +++ b/Projects/Features/StorageFeature/Sources/Components/FaqComponent.swift @@ -0,0 +1,27 @@ +// +// SearchComponent.swift +// SearchFeature +// +// Created by yongbeomkwak on 2023/02/10. +// Copyright © 2023 yongbeomkwak. All rights reserved. +// + +import Foundation +import NeedleFoundation +import DomainModule + +public protocol FaqDependency: Dependency { + + + var faqContentComponent : FaqContentComponent {get} + var fetchFaqCategoriesUseCase : any FetchFaqCategoriesUseCase {get} + var fetchFaqUseCase : any FetchFaqUseCase {get} + + +} + +public final class FaqComponent: Component { + public func makeView() -> FaqViewController { + return FaqViewController.viewController(viewModel: .init(fetchFaqCategoriesUseCase: dependency.fetchFaqCategoriesUseCase,fetchQnaUseCase: dependency.fetchFaqUseCase), faqContentComponent: dependency.faqContentComponent) + } +} diff --git a/Projects/Features/StorageFeature/Sources/Components/QnaContentComponent.swift b/Projects/Features/StorageFeature/Sources/Components/FaqContentComponent.swift similarity index 51% rename from Projects/Features/StorageFeature/Sources/Components/QnaContentComponent.swift rename to Projects/Features/StorageFeature/Sources/Components/FaqContentComponent.swift index e54d34def..5fe86037c 100644 --- a/Projects/Features/StorageFeature/Sources/Components/QnaContentComponent.swift +++ b/Projects/Features/StorageFeature/Sources/Components/FaqContentComponent.swift @@ -10,12 +10,9 @@ import Foundation import NeedleFoundation import DomainModule -public protocol QnaContentDependency: Dependency { -} - -public final class QnaContentComponent: Component { - public func makeView(dataSource:[QnaEntity]) -> QnaContentViewController { - return QnaContentViewController.viewController(viewModel: .init(dataSource: dataSource)) +public final class FaqContentComponent: Component { + public func makeView(dataSource:[FaqEntity]) -> FaqContentViewController { + return FaqContentViewController.viewController(viewModel: .init(dataSource: dataSource)) } } diff --git a/Projects/Features/StorageFeature/Sources/Components/QnaComponent.swift b/Projects/Features/StorageFeature/Sources/Components/QnaComponent.swift deleted file mode 100644 index cd4bb0898..000000000 --- a/Projects/Features/StorageFeature/Sources/Components/QnaComponent.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// SearchComponent.swift -// SearchFeature -// -// Created by yongbeomkwak on 2023/02/10. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import Foundation -import NeedleFoundation -import DomainModule - -public protocol QnaDependency: Dependency { - - - var qnaContentComponent : QnaContentComponent {get} - var fetchQnaCategoriesUseCase : any FetchQnaCategoriesUseCase {get} - var fetchQnaUseCase : any FetchQnaUseCase {get} - - -} - -public final class QnaComponent: Component { - public func makeView() -> QnaViewController { - return QnaViewController.viewController(viewModel: .init(fetchQnaCategoriesUseCase: dependency.fetchQnaCategoriesUseCase,fetchQnaUseCase: dependency.fetchQnaUseCase), qnaContentComponent: dependency.qnaContentComponent) - } -} diff --git a/Projects/Features/StorageFeature/Sources/Components/RequestComponent.swift b/Projects/Features/StorageFeature/Sources/Components/RequestComponent.swift index 0677cfe81..abc79290f 100644 --- a/Projects/Features/StorageFeature/Sources/Components/RequestComponent.swift +++ b/Projects/Features/StorageFeature/Sources/Components/RequestComponent.swift @@ -13,7 +13,7 @@ import CommonFeature public protocol RequestDependency: Dependency { var withdrawUserInfoUseCase: any WithdrawUserInfoUseCase {get} - var qnaComponent: QnaComponent {get} + var faqComponent: FaqComponent {get} var questionComponent: QuestionComponent {get} var containSongsComponent: ContainSongsComponent {get} var noticeComponent: NoticeComponent {get} @@ -26,7 +26,7 @@ public final class RequestComponent: Component { viewModel: .init( withDrawUserInfoUseCase: dependency.withdrawUserInfoUseCase ), - qnaComponent:dependency.qnaComponent, + faqComponent:dependency.faqComponent, questionComponent: dependency.questionComponent, containSongsComponent: dependency.containSongsComponent, noticeComponent: dependency.noticeComponent, diff --git a/Projects/Features/StorageFeature/Sources/ViewControllers/QnaContentViewController.swift b/Projects/Features/StorageFeature/Sources/ViewControllers/FaqContentViewController.swift similarity index 92% rename from Projects/Features/StorageFeature/Sources/ViewControllers/QnaContentViewController.swift rename to Projects/Features/StorageFeature/Sources/ViewControllers/FaqContentViewController.swift index f1e97b43e..e812d3f60 100644 --- a/Projects/Features/StorageFeature/Sources/ViewControllers/QnaContentViewController.swift +++ b/Projects/Features/StorageFeature/Sources/ViewControllers/FaqContentViewController.swift @@ -13,7 +13,7 @@ import RxCocoa import RxRelay import CommonFeature -public final class QnaContentViewController: UIViewController, ViewControllerFromStoryBoard { +public final class FaqContentViewController: UIViewController, ViewControllerFromStoryBoard { @IBOutlet weak var tableView: UITableView! var viewModel:QnaContentViewModel! @@ -28,14 +28,14 @@ public final class QnaContentViewController: UIViewController, ViewControllerFro navigationController?.interactivePopGestureRecognizer?.delegate = nil //스와이프로 뒤로가기 } - public static func viewController(viewModel: QnaContentViewModel) -> QnaContentViewController { - let viewController = QnaContentViewController.viewController(storyBoardName: "Storage", bundle: Bundle.module) + public static func viewController(viewModel: QnaContentViewModel) -> FaqContentViewController { + let viewController = FaqContentViewController.viewController(storyBoardName: "Storage", bundle: Bundle.module) viewController.viewModel = viewModel return viewController } } -extension QnaContentViewController{ +extension FaqContentViewController{ private func configureUI(){ tableView.dataSource = self tableView.delegate = self @@ -55,7 +55,7 @@ extension QnaContentViewController{ } } -extension QnaContentViewController:UITableViewDataSource{ +extension FaqContentViewController:UITableViewDataSource{ public func numberOfSections(in tableView: UITableView) -> Int { return viewModel.dataSource.count } @@ -96,7 +96,7 @@ extension QnaContentViewController:UITableViewDataSource{ } } -extension QnaContentViewController:UITableViewDelegate{ +extension FaqContentViewController:UITableViewDelegate{ public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/Projects/Features/StorageFeature/Sources/ViewControllers/QnaViewController.swift b/Projects/Features/StorageFeature/Sources/ViewControllers/FaqViewController.swift similarity index 85% rename from Projects/Features/StorageFeature/Sources/ViewControllers/QnaViewController.swift rename to Projects/Features/StorageFeature/Sources/ViewControllers/FaqViewController.swift index 949164ef2..2f59e5a46 100644 --- a/Projects/Features/StorageFeature/Sources/ViewControllers/QnaViewController.swift +++ b/Projects/Features/StorageFeature/Sources/ViewControllers/FaqViewController.swift @@ -14,7 +14,7 @@ import DesignSystem import RxSwift import NVActivityIndicatorView -public final class QnaViewController: TabmanViewController, ViewControllerFromStoryBoard { +public final class FaqViewController: TabmanViewController, ViewControllerFromStoryBoard { @IBOutlet weak var backButton: UIButton! @@ -38,22 +38,22 @@ public final class QnaViewController: TabmanViewController, ViewControllerFromSt } var disposeBag = DisposeBag() - var viewModel:QnaViewModel! - var qnaContentComponent:QnaContentComponent! - lazy var input = QnaViewModel.Input() + var viewModel:FaqViewModel! + var faqContentComponent:FaqContentComponent! + lazy var input = FaqViewModel.Input() lazy var output = viewModel.transform(from: input) var viewControllers:[UIViewController] = [] - public static func viewController(viewModel:QnaViewModel,qnaContentComponent:QnaContentComponent) -> QnaViewController { - let viewController = QnaViewController.viewController(storyBoardName: "Storage", bundle: Bundle.module) + public static func viewController(viewModel:FaqViewModel,faqContentComponent:FaqContentComponent) -> FaqViewController { + let viewController = FaqViewController.viewController(storyBoardName: "Storage", bundle: Bundle.module) viewController.viewModel = viewModel - viewController.qnaContentComponent = qnaContentComponent + viewController.faqContentComponent = faqContentComponent return viewController } } -extension QnaViewController { +extension FaqViewController { private func configureUI(){ self.backButton.setImage(DesignSystemAsset.Navigation.back.image, for: .normal) @@ -103,16 +103,16 @@ extension QnaViewController { guard let self = self else{ return } - guard let comp = self.qnaContentComponent else{ + guard let comp = self.faqContentComponent else{ return } self.viewControllers = categories.enumerated().map { (i,c) in if i == 0 { - return comp.makeView(dataSource: qna ) + return comp.makeView(dataSource: qna) }else { return comp.makeView(dataSource: qna.filter({ - $0.category.replacingOccurrences(of: " ", with: "") == c.category.replacingOccurrences(of: " ", with: "") + $0.category.replacingOccurrences(of: " ", with: "") == c.replacingOccurrences(of: " ", with: "") })) } } @@ -121,7 +121,7 @@ extension QnaViewController { } } -extension QnaViewController:PageboyViewControllerDataSource, TMBarDataSource { +extension FaqViewController:PageboyViewControllerDataSource, TMBarDataSource { public func numberOfViewControllers(in pageboyViewController: Pageboy.PageboyViewController) -> Int { DEBUG_LOG(self.viewControllers.count) return self.viewControllers.count @@ -136,6 +136,6 @@ extension QnaViewController:PageboyViewControllerDataSource, TMBarDataSource { } public func barItem(for bar: Tabman.TMBar, at index: Int) -> Tabman.TMBarItemable { - return TMBarItem(title: output.dataSource.value.0[index].category) + return TMBarItem(title: output.dataSource.value.0[index]) } } diff --git a/Projects/Features/StorageFeature/Sources/ViewControllers/RequestViewController.swift b/Projects/Features/StorageFeature/Sources/ViewControllers/RequestViewController.swift index 4bbd919f9..15542bea0 100644 --- a/Projects/Features/StorageFeature/Sources/ViewControllers/RequestViewController.swift +++ b/Projects/Features/StorageFeature/Sources/ViewControllers/RequestViewController.swift @@ -49,7 +49,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt } @IBAction func moveQnaAction(_ sender: UIButton) { - let vc = qnaComponent.makeView() + let vc = faqComponent.makeView() self.navigationController?.pushViewController(vc, animated: true) } @@ -79,7 +79,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt lazy var input = RequestViewModel.Input() lazy var output = viewModel.transform(from: input) - var qnaComponent:QnaComponent! + var faqComponent:FaqComponent! var questionComponent:QuestionComponent! var containSongsComponent: ContainSongsComponent! var noticeComponent: NoticeComponent! @@ -101,7 +101,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt public static func viewController( viewModel:RequestViewModel, - qnaComponent: QnaComponent, + faqComponent: FaqComponent, questionComponent: QuestionComponent, containSongsComponent: ContainSongsComponent, noticeComponent: NoticeComponent, @@ -109,7 +109,7 @@ public final class RequestViewController: UIViewController, ViewControllerFromSt ) -> RequestViewController { let viewController = RequestViewController.viewController(storyBoardName: "Storage", bundle: Bundle.module) viewController.viewModel = viewModel - viewController.qnaComponent = qnaComponent + viewController.faqComponent = faqComponent viewController.questionComponent = questionComponent viewController.containSongsComponent = containSongsComponent viewController.noticeComponent = noticeComponent diff --git a/Projects/Features/StorageFeature/Sources/ViewModels/QnaViewModel.swift b/Projects/Features/StorageFeature/Sources/ViewModels/FaqViewModel.swift similarity index 51% rename from Projects/Features/StorageFeature/Sources/ViewModels/QnaViewModel.swift rename to Projects/Features/StorageFeature/Sources/ViewModels/FaqViewModel.swift index fe59a8ca9..4c42b6aa6 100644 --- a/Projects/Features/StorageFeature/Sources/ViewModels/QnaViewModel.swift +++ b/Projects/Features/StorageFeature/Sources/ViewModels/FaqViewModel.swift @@ -14,46 +14,45 @@ import DomainModule import BaseFeature import KeychainModule -final public class QnaViewModel:ViewModelType { +final public class FaqViewModel:ViewModelType { var disposeBag = DisposeBag() - var fetchQnaCategoriesUseCase: FetchQnaCategoriesUseCase! - var fetchQnaUseCase: FetchQnaUseCase! + var fetchFaqCategoriesUseCase: FetchFaqCategoriesUseCase! + var fetchQnaUseCase: FetchFaqUseCase! public struct Input { } public struct Output { - let dataSource:BehaviorRelay<([QnaCategoryEntity], [QnaEntity])> = BehaviorRelay(value: ([], [])) + let dataSource:BehaviorRelay<([String], [FaqEntity])> = BehaviorRelay(value: ([], [])) } public init( - fetchQnaCategoriesUseCase: FetchQnaCategoriesUseCase, - fetchQnaUseCase: FetchQnaUseCase + fetchFaqCategoriesUseCase: FetchFaqCategoriesUseCase, + fetchQnaUseCase: FetchFaqUseCase ) { DEBUG_LOG("✅ \(Self.self) 생성") - self.fetchQnaCategoriesUseCase = fetchQnaCategoriesUseCase + self.fetchFaqCategoriesUseCase = fetchFaqCategoriesUseCase self.fetchQnaUseCase = fetchQnaUseCase } public func transform(from input: Input) -> Output { let output = Output() - let zip1 = fetchQnaCategoriesUseCase.execute().catchAndReturn([]) + let zip1 = fetchFaqCategoriesUseCase.execute() + .catchAndReturn(FaqCategoryEntity(categories: [])) .map({ - var result:[QnaCategoryEntity] = [QnaCategoryEntity(category: "전체 ")] + var result:[String] = [String("전체 ")] - result += $0 - .map({ - $0.category.count < 6 ? - QnaCategoryEntity(category: $0.category + String(repeating: " ", count: 6 - $0.category.count)) : - $0 }) + result += $0.categories.map{$0.count < 6 ? $0 + String(repeating: " ", count: 6 - $0.count) : $0} + DEBUG_LOG(result) return result }) .asObservable() - let zip2 = fetchQnaUseCase.execute().catchAndReturn([]) + let zip2 = fetchQnaUseCase.execute() + .catchAndReturn([]) .asObservable() Observable.zip(zip1, zip2) diff --git a/Projects/Features/StorageFeature/Sources/ViewModels/QnaContentViewModel.swift b/Projects/Features/StorageFeature/Sources/ViewModels/QnaContentViewModel.swift index c895fbd57..723a046ea 100644 --- a/Projects/Features/StorageFeature/Sources/ViewModels/QnaContentViewModel.swift +++ b/Projects/Features/StorageFeature/Sources/ViewModels/QnaContentViewModel.swift @@ -16,7 +16,7 @@ import KeychainModule final public class QnaContentViewModel:ViewModelType { var disposeBag = DisposeBag() - var dataSource:[QnaEntity] + var dataSource:[FaqEntity] public struct Input { } @@ -25,7 +25,7 @@ final public class QnaContentViewModel:ViewModelType { } public init( - dataSource:[QnaEntity] + dataSource:[FaqEntity] ) { DEBUG_LOG("✅ \(Self.self) 생성") self.dataSource = dataSource diff --git a/Projects/Features/StorageFeature/Sources/Views/AnswerTableViewCell.swift b/Projects/Features/StorageFeature/Sources/Views/AnswerTableViewCell.swift index f6efa2f36..be1edd2b5 100644 --- a/Projects/Features/StorageFeature/Sources/Views/AnswerTableViewCell.swift +++ b/Projects/Features/StorageFeature/Sources/Views/AnswerTableViewCell.swift @@ -24,7 +24,7 @@ class AnswerTableViewCell: UITableViewCell { } extension AnswerTableViewCell{ - public func update(model:QnaEntity){ + public func update(model:FaqEntity){ answerLabel.text = model.description } } diff --git a/Projects/Features/StorageFeature/Sources/Views/QuestionTableViewCell.swift b/Projects/Features/StorageFeature/Sources/Views/QuestionTableViewCell.swift index 51571203e..e441bfa54 100644 --- a/Projects/Features/StorageFeature/Sources/Views/QuestionTableViewCell.swift +++ b/Projects/Features/StorageFeature/Sources/Views/QuestionTableViewCell.swift @@ -27,7 +27,7 @@ class QuestionTableViewCell: UITableViewCell { } extension QuestionTableViewCell{ - public func update(model:QnaEntity){ + public func update(model:FaqEntity){ categoryLabel.text = model.category titleLabel.text = model.question expandImageView.image = model.isOpen ? DesignSystemAsset.Navigation.fold.image : DesignSystemAsset.Navigation.close.image diff --git a/Projects/Services/APIKit/Sources/API/QnaAPI.swift b/Projects/Services/APIKit/Sources/API/FaqAPI.swift similarity index 75% rename from Projects/Services/APIKit/Sources/API/QnaAPI.swift rename to Projects/Services/APIKit/Sources/API/FaqAPI.swift index d585c11cb..21e49cb89 100644 --- a/Projects/Services/APIKit/Sources/API/QnaAPI.swift +++ b/Projects/Services/APIKit/Sources/API/FaqAPI.swift @@ -4,36 +4,36 @@ import ErrorModule import Foundation import KeychainModule -public enum QnaAPI { - case fetchQnaCategories - case fetchQna +public enum FaqAPI { + case fetchFaqCategories + case fetchFaq } -extension QnaAPI: WMAPI { +extension FaqAPI: WMAPI { public var domain: WMDomain { - .qna + .faq } public var urlPath: String { switch self { - case .fetchQnaCategories: + case .fetchFaqCategories: return "/categories" - case .fetchQna: - return "/" + case .fetchFaq: + return "" } } public var method: Moya.Method { switch self { - case .fetchQnaCategories,.fetchQna: + case .fetchFaqCategories,.fetchFaq: return .get } } public var task: Moya.Task { switch self { - case .fetchQnaCategories,.fetchQna: + case .fetchFaqCategories,.fetchFaq: return .requestPlain } } diff --git a/Projects/Services/APIKit/Sources/API/WMAPI.swift b/Projects/Services/APIKit/Sources/API/WMAPI.swift index cbb29ec3d..ee6e41cc7 100644 --- a/Projects/Services/APIKit/Sources/API/WMAPI.swift +++ b/Projects/Services/APIKit/Sources/API/WMAPI.swift @@ -36,7 +36,7 @@ public enum WMDomain: String { case playlist case like case naver - case qna + case faq case notice case suggest case app @@ -68,7 +68,7 @@ extension WMDomain { return WMDOMAIN_LIKE() case .naver: return "/v1/nid/me" - case .qna: + case .faq: return WMDOMAIN_QNA() case .notice: return WMDOMAIN_NOTICE() diff --git a/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqCategoryResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqCategoryResponseDTO.swift new file mode 100644 index 000000000..b12aebe5c --- /dev/null +++ b/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqCategoryResponseDTO.swift @@ -0,0 +1,5 @@ +import Foundation + +public struct FaqCategoryResponseDTO: Codable, Equatable { + public let categories: [String] +} diff --git a/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqResponseDTO.swift new file mode 100644 index 000000000..5fbded635 --- /dev/null +++ b/Projects/Services/DataMappingModule/Sources/Faq/Response/FaqResponseDTO.swift @@ -0,0 +1,20 @@ +// +// ArtistListResponseDTO.swift +// DataMappingModule +// +// Created by KTH on 2023/02/01. +// Copyright © 2023 yongbeomkwak. All rights reserved. +// + +import Foundation + +public struct FaqResponseDTO: Decodable { + public let question, description: String + public let category: String + + private enum CodingKeys: String, CodingKey { + case question, description, category + } +} + + diff --git a/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaCategoryResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaCategoryResponseDTO.swift deleted file mode 100644 index fa2ae675a..000000000 --- a/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaCategoryResponseDTO.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public struct QnaCategoryResponseDTO: Codable, Equatable { - public let type, category: String -} diff --git a/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaResponseDTO.swift deleted file mode 100644 index c09d9df65..000000000 --- a/Projects/Services/DataMappingModule/Sources/Qna/Response/QnaResponseDTO.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// ArtistListResponseDTO.swift -// DataMappingModule -// -// Created by KTH on 2023/02/01. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import Foundation - -public struct QnaResponseDTO: Decodable { - public let createAt: Int - public let question, description: String - public let category: QnaResponseDTO.Category? - - private enum CodingKeys: String, CodingKey { - case createAt, question, description, category - } -} - -public extension QnaResponseDTO { - struct Category: Codable { - public let type: String - public let category: String - } -} diff --git a/Projects/Services/DataModule/Sources/Faq/Repositories/FaqRepositoryImpl.swift b/Projects/Services/DataModule/Sources/Faq/Repositories/FaqRepositoryImpl.swift new file mode 100644 index 000000000..be03f2b43 --- /dev/null +++ b/Projects/Services/DataModule/Sources/Faq/Repositories/FaqRepositoryImpl.swift @@ -0,0 +1,35 @@ +// +// ArtistRepositoryImpl.swift +// DataModule +// +// Created by KTH on 2023/02/08. +// Copyright © 2023 yongbeomkwak. All rights reserved. +// + +import DataMappingModule +import DomainModule +import ErrorModule +import NetworkModule +import DatabaseModule +import RxSwift + +public struct FaqRepositoryImpl: FaqRepository { + + private let remoteFaqDataSource: any RemoteFaqDataSource + + public init( + remoteFaqDataSource: RemoteFaqDataSource + ) { + self.remoteFaqDataSource = remoteFaqDataSource + } + + public func fetchQnaCategories() -> Single { + remoteFaqDataSource.fetchCategories() + } + + public func fetchQna() -> Single<[FaqEntity]> { + remoteFaqDataSource.fetchQna() + } + + +} diff --git a/Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaCategoriesUseCaseImpl.swift b/Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqCategoriesUseCaseImpl.swift similarity index 51% rename from Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaCategoriesUseCaseImpl.swift rename to Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqCategoriesUseCaseImpl.swift index 32d5800af..cc9aa7b8a 100644 --- a/Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaCategoriesUseCaseImpl.swift +++ b/Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqCategoriesUseCaseImpl.swift @@ -12,19 +12,19 @@ import DataMappingModule import DomainModule import ErrorModule -public struct FetchQnaCategoriesUseCaseImpl: FetchQnaCategoriesUseCase { +public struct FetchFaqCategoriesUseCaseImpl: FetchFaqCategoriesUseCase { - private let qnaRepository: any QnaRepository + private let faqRepository: any FaqRepository public init( - qnaRepository: QnaRepository + faqRepository: FaqRepository ) { - self.qnaRepository = qnaRepository + self.faqRepository = faqRepository } - public func execute() -> Single<[QnaCategoryEntity]> { - qnaRepository.fetchQnaCategories() + public func execute() -> Single { + faqRepository.fetchQnaCategories() } } diff --git a/Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaUseCaseImpl.swift b/Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqUseCaseImpl.swift similarity index 53% rename from Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaUseCaseImpl.swift rename to Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqUseCaseImpl.swift index a1c0e3f3d..64b030988 100644 --- a/Projects/Services/DataModule/Sources/Qna/UseCases/FetchQnaUseCaseImpl.swift +++ b/Projects/Services/DataModule/Sources/Faq/UseCases/FetchFaqUseCaseImpl.swift @@ -12,21 +12,21 @@ import DataMappingModule import DomainModule import ErrorModule -public struct FetchQnaUseCaseImpl: FetchQnaUseCase { +public struct FetchFaqUseCaseImpl: FetchFaqUseCase { - private let qnaRepository: any QnaRepository + private let faqRepository: any FaqRepository public init( - qnaRepository: QnaRepository + faqRepository: FaqRepository ) { - self.qnaRepository = qnaRepository + self.faqRepository = faqRepository } - public func execute() -> Single<[QnaEntity]> { - qnaRepository.fetchQna() + public func execute() -> Single<[FaqEntity]> { + faqRepository.fetchQna() } diff --git a/Projects/Services/DataModule/Sources/Qna/Repositories/QnaRepositoryImpl.swift b/Projects/Services/DataModule/Sources/Qna/Repositories/QnaRepositoryImpl.swift deleted file mode 100644 index f73a4caaf..000000000 --- a/Projects/Services/DataModule/Sources/Qna/Repositories/QnaRepositoryImpl.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ArtistRepositoryImpl.swift -// DataModule -// -// Created by KTH on 2023/02/08. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import DataMappingModule -import DomainModule -import ErrorModule -import NetworkModule -import DatabaseModule -import RxSwift - -public struct QnaRepositoryImpl: QnaRepository { - - private let remoteQnaDataSource: any RemoteQnaDataSource - - public init( - remoteQnaDataSource: RemoteQnaDataSource - ) { - self.remoteQnaDataSource = remoteQnaDataSource - } - - public func fetchQnaCategories() -> Single<[QnaCategoryEntity]> { - remoteQnaDataSource.fetchCategories() - } - - public func fetchQna() -> Single<[QnaEntity]> { - remoteQnaDataSource.fetchQna() - } - - -} diff --git a/Projects/Services/DomainModule/Sources/Faq/Entity/FaqCategoryEntity.swift b/Projects/Services/DomainModule/Sources/Faq/Entity/FaqCategoryEntity.swift new file mode 100644 index 000000000..0d99245cd --- /dev/null +++ b/Projects/Services/DomainModule/Sources/Faq/Entity/FaqCategoryEntity.swift @@ -0,0 +1,10 @@ +import Foundation + +public struct FaqCategoryEntity: Equatable { + public init( + categories: [String] + ) { + self.categories = categories + } + public let categories: [String] +} diff --git a/Projects/Services/DomainModule/Sources/Qna/Entity/QnaEntity.swift b/Projects/Services/DomainModule/Sources/Faq/Entity/FaqEntity.swift similarity index 74% rename from Projects/Services/DomainModule/Sources/Qna/Entity/QnaEntity.swift rename to Projects/Services/DomainModule/Sources/Faq/Entity/FaqEntity.swift index 92e6ce40f..287232a8d 100644 --- a/Projects/Services/DomainModule/Sources/Qna/Entity/QnaEntity.swift +++ b/Projects/Services/DomainModule/Sources/Faq/Entity/FaqEntity.swift @@ -1,20 +1,17 @@ import Foundation -public struct QnaEntity: Equatable { +public struct FaqEntity: Equatable { public init( - create_at: Int, category: String, question: String, description: String, isOpen: Bool ) { - self.create_at = create_at self.category = category self.question = question self.description = description self.isOpen = isOpen } - public let create_at: Int public let category,question,description:String public var isOpen:Bool } diff --git a/Projects/Services/DomainModule/Sources/Qna/Repository/QnaRepository.swift b/Projects/Services/DomainModule/Sources/Faq/Repository/FaqRepository.swift similarity index 62% rename from Projects/Services/DomainModule/Sources/Qna/Repository/QnaRepository.swift rename to Projects/Services/DomainModule/Sources/Faq/Repository/FaqRepository.swift index 3bc7024cb..aa938d303 100644 --- a/Projects/Services/DomainModule/Sources/Qna/Repository/QnaRepository.swift +++ b/Projects/Services/DomainModule/Sources/Faq/Repository/FaqRepository.swift @@ -11,7 +11,7 @@ import RxSwift import DataMappingModule import ErrorModule -public protocol QnaRepository { - func fetchQnaCategories() -> Single<[QnaCategoryEntity]> - func fetchQna() -> Single<[QnaEntity]> +public protocol FaqRepository { + func fetchQnaCategories() -> Single + func fetchQna() -> Single<[FaqEntity]> } diff --git a/Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaCategoriesUseCase.swift b/Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqCategoriesUseCase.swift similarity index 69% rename from Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaCategoriesUseCase.swift rename to Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqCategoriesUseCase.swift index beafa931d..9d5d2b97a 100644 --- a/Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaCategoriesUseCase.swift +++ b/Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqCategoriesUseCase.swift @@ -10,6 +10,6 @@ import Foundation import RxSwift import DataMappingModule -public protocol FetchQnaCategoriesUseCase { - func execute() -> Single<[QnaCategoryEntity]> +public protocol FetchFaqCategoriesUseCase { + func execute() -> Single } diff --git a/Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaUseCase.swift b/Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqUseCase.swift similarity index 73% rename from Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaUseCase.swift rename to Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqUseCase.swift index 7a36e9de8..a8827b179 100644 --- a/Projects/Services/DomainModule/Sources/Qna/UseCase/FetchQnaUseCase.swift +++ b/Projects/Services/DomainModule/Sources/Faq/UseCase/FetchFaqUseCase.swift @@ -10,6 +10,6 @@ import Foundation import RxSwift import DataMappingModule -public protocol FetchQnaUseCase { - func execute() -> Single<[QnaEntity]> +public protocol FetchFaqUseCase { + func execute() -> Single<[FaqEntity]> } diff --git a/Projects/Services/DomainModule/Sources/Qna/Entity/QnaCategoryEntity.swift b/Projects/Services/DomainModule/Sources/Qna/Entity/QnaCategoryEntity.swift deleted file mode 100644 index 79441b386..000000000 --- a/Projects/Services/DomainModule/Sources/Qna/Entity/QnaCategoryEntity.swift +++ /dev/null @@ -1,10 +0,0 @@ -import Foundation - -public struct QnaCategoryEntity: Equatable { - public init( - category: String - ) { - self.category = category - } - public let category: String -} diff --git a/Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchCategoriesTransfer.swift b/Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchCategoriesTransfer.swift new file mode 100644 index 000000000..d2bbcf559 --- /dev/null +++ b/Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchCategoriesTransfer.swift @@ -0,0 +1,12 @@ +import DataMappingModule +import DomainModule +import Utility + + +public extension FaqCategoryResponseDTO { + func toDomain() -> FaqCategoryEntity { + FaqCategoryEntity( + categories: categories + ) + } +} diff --git a/Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchQnaTransfer.swift b/Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchQnaTransfer.swift similarity index 51% rename from Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchQnaTransfer.swift rename to Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchQnaTransfer.swift index 696dc4294..cc3d73c86 100644 --- a/Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchQnaTransfer.swift +++ b/Projects/Services/NetworkModule/Sources/Faq/DataTransfer/FetchQnaTransfer.swift @@ -3,11 +3,10 @@ import DomainModule import Utility -public extension QnaResponseDTO { - func toDomain() -> QnaEntity { - QnaEntity( - create_at: createAt, - category: category?.category ?? "", +public extension FaqResponseDTO { + func toDomain() -> FaqEntity { + FaqEntity( + category: category, question: question, description: description, isOpen: false diff --git a/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSource.swift b/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSource.swift new file mode 100644 index 000000000..e7a7e24ee --- /dev/null +++ b/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSource.swift @@ -0,0 +1,10 @@ +import DataMappingModule +import ErrorModule +import DomainModule +import RxSwift +import Foundation + +public protocol RemoteFaqDataSource { + func fetchCategories() -> Single + func fetchQna() -> Single<[FaqEntity]> +} diff --git a/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSourceImpl.swift new file mode 100644 index 000000000..0bed44dff --- /dev/null +++ b/Projects/Services/NetworkModule/Sources/Faq/Remote/RemoteFaqDataSourceImpl.swift @@ -0,0 +1,21 @@ +import APIKit +import RxSwift +import DataMappingModule +import DomainModule +import ErrorModule +import Foundation + + +public final class RemoteFaqDataSourceImpl: BaseRemoteDataSource, RemoteFaqDataSource { + public func fetchCategories() -> Single { + return request(.fetchFaqCategories) + .map(FaqCategoryResponseDTO.self) + .map({$0.toDomain()}) + } + + public func fetchQna() -> Single<[FaqEntity]> { + return request(.fetchFaq) + .map([FaqResponseDTO].self) + .map({$0.map({$0.toDomain()})}) + } +} diff --git a/Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchCategoriesTransfer.swift b/Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchCategoriesTransfer.swift deleted file mode 100644 index f8ca68a80..000000000 --- a/Projects/Services/NetworkModule/Sources/Qna/DataTransfer/FetchCategoriesTransfer.swift +++ /dev/null @@ -1,12 +0,0 @@ -import DataMappingModule -import DomainModule -import Utility - - -public extension QnaCategoryResponseDTO { - func toDomain() -> QnaCategoryEntity { - QnaCategoryEntity( - category: category - ) - } -} diff --git a/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSource.swift b/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSource.swift deleted file mode 100644 index a5bc8bd39..000000000 --- a/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSource.swift +++ /dev/null @@ -1,10 +0,0 @@ -import DataMappingModule -import ErrorModule -import DomainModule -import RxSwift -import Foundation - -public protocol RemoteQnaDataSource { - func fetchCategories() -> Single<[QnaCategoryEntity]> - func fetchQna() -> Single<[QnaEntity]> -} diff --git a/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSourceImpl.swift deleted file mode 100644 index d762b4dac..000000000 --- a/Projects/Services/NetworkModule/Sources/Qna/Remote/RemoteQnaDataSourceImpl.swift +++ /dev/null @@ -1,21 +0,0 @@ -import APIKit -import RxSwift -import DataMappingModule -import DomainModule -import ErrorModule -import Foundation - - -public final class RemoteQnaDataSourceImpl: BaseRemoteDataSource, RemoteQnaDataSource { - public func fetchCategories() -> Single<[QnaCategoryEntity]> { - return request(.fetchQnaCategories) - .map([QnaCategoryResponseDTO].self) - .map({$0.map({QnaCategoryEntity(category: $0.category)})}) - } - - public func fetchQna() -> Single<[QnaEntity]> { - return request(.fetchQna) - .map([QnaResponseDTO].self) - .map({$0.map({$0.toDomain()})}) - } -}