diff --git a/Projects/App/Sources/Application/AppComponent+Songs.swift b/Projects/App/Sources/Application/AppComponent+Songs.swift index 9d847c622..6fad7557c 100644 --- a/Projects/App/Sources/Application/AppComponent+Songs.swift +++ b/Projects/App/Sources/Application/AppComponent+Songs.swift @@ -38,6 +38,12 @@ public extension AppComponent { } } + var fetchSongUseCase: any FetchSongUseCase { + shared { + FetchSongUseCaseImpl(songsRepository: songsRepository) + } + } + var fetchLyricsUseCase: any FetchLyricsUseCase { shared { FetchLyricsUseCaseImpl(songsRepository: songsRepository) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index e6075f6bd..90a72d8ca 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -888,101 +888,102 @@ private func factorybe60e92b5190e00abf41e3b0c44298fc1c149afb(_ component: Needle extension AppComponent: Registration { public func registerItems() { - localTable["keychain-any Keychain"] = { [unowned self] in self.keychain as Any } - localTable["homeComponent-HomeComponent"] = { [unowned self] in self.homeComponent as Any } - localTable["newSongsComponent-NewSongsComponent"] = { [unowned self] in self.newSongsComponent as Any } - localTable["newSongsContentComponent-NewSongsContentComponent"] = { [unowned self] in self.newSongsContentComponent as Any } - localTable["lyricHighlightingFactory-any LyricHighlightingFactory"] = { [unowned self] in self.lyricHighlightingFactory as Any } - localTable["lyricDecoratingComponent-LyricDecoratingComponent"] = { [unowned self] in self.lyricDecoratingComponent as Any } - localTable["remoteSongsDataSource-any RemoteSongsDataSource"] = { [unowned self] in self.remoteSongsDataSource as Any } - localTable["songsRepository-any SongsRepository"] = { [unowned self] in self.songsRepository as Any } - localTable["fetchLyricsUseCase-any FetchLyricsUseCase"] = { [unowned self] in self.fetchLyricsUseCase as Any } - localTable["fetchNewSongsUseCase-any FetchNewSongsUseCase"] = { [unowned self] in self.fetchNewSongsUseCase as Any } - localTable["signInFactory-any SignInFactory"] = { [unowned self] in self.signInFactory as Any } - localTable["storageFactory-any StorageFactory"] = { [unowned self] in self.storageFactory as Any } - localTable["requestComponent-RequestComponent"] = { [unowned self] in self.requestComponent as Any } - localTable["localAuthDataSource-any LocalAuthDataSource"] = { [unowned self] in self.localAuthDataSource as Any } - localTable["remoteAuthDataSource-any RemoteAuthDataSource"] = { [unowned self] in self.remoteAuthDataSource as Any } - localTable["authRepository-any AuthRepository"] = { [unowned self] in self.authRepository as Any } - localTable["fetchTokenUseCase-any FetchTokenUseCase"] = { [unowned self] in self.fetchTokenUseCase as Any } - localTable["fetchNaverUserInfoUseCase-any FetchNaverUserInfoUseCase"] = { [unowned self] in self.fetchNaverUserInfoUseCase as Any } - localTable["logoutUseCase-any LogoutUseCase"] = { [unowned self] in self.logoutUseCase as Any } - localTable["checkIsExistAccessTokenUseCase-any CheckIsExistAccessTokenUseCase"] = { [unowned self] in self.checkIsExistAccessTokenUseCase as Any } - localTable["remoteLikeDataSource-any RemoteLikeDataSource"] = { [unowned self] in self.remoteLikeDataSource as Any } - localTable["likeRepository-any LikeRepository"] = { [unowned self] in self.likeRepository as Any } - localTable["fetchLikeNumOfSongUseCase-any FetchLikeNumOfSongUseCase"] = { [unowned self] in self.fetchLikeNumOfSongUseCase as Any } - localTable["addLikeSongUseCase-any AddLikeSongUseCase"] = { [unowned self] in self.addLikeSongUseCase as Any } - localTable["cancelLikeSongUseCase-any CancelLikeSongUseCase"] = { [unowned self] in self.cancelLikeSongUseCase as Any } - localTable["playlistDetailFactory-any PlaylistDetailFactory"] = { [unowned self] in self.playlistDetailFactory as Any } - localTable["myPlayListComponent-MyPlayListComponent"] = { [unowned self] in self.myPlayListComponent as Any } - localTable["remotePlayListDataSource-any RemotePlayListDataSource"] = { [unowned self] in self.remotePlayListDataSource as Any } - localTable["playListRepository-any PlayListRepository"] = { [unowned self] in self.playListRepository as Any } - localTable["fetchRecommendPlayListUseCase-any FetchRecommendPlayListUseCase"] = { [unowned self] in self.fetchRecommendPlayListUseCase as Any } - localTable["fetchPlayListDetailUseCase-any FetchPlayListDetailUseCase"] = { [unowned self] in self.fetchPlayListDetailUseCase as Any } - localTable["createPlayListUseCase-any CreatePlayListUseCase"] = { [unowned self] in self.createPlayListUseCase as Any } - localTable["updatePlaylistUseCase-any UpdatePlaylistUseCase"] = { [unowned self] in self.updatePlaylistUseCase as Any } - localTable["updateTitleAndPrivateUseCase-any UpdateTitleAndPrivateUseCase"] = { [unowned self] in self.updateTitleAndPrivateUseCase as Any } - localTable["addSongIntoPlayListUseCase-any AddSongIntoPlayListUseCase"] = { [unowned self] in self.addSongIntoPlayListUseCase as Any } - localTable["removeSongsUseCase-any RemoveSongsUseCase"] = { [unowned self] in self.removeSongsUseCase as Any } - localTable["uploadPlaylistImageUseCase-any UploadPlaylistImageUseCase"] = { [unowned self] in self.uploadPlaylistImageUseCase as Any } - localTable["artistComponent-ArtistComponent"] = { [unowned self] in self.artistComponent as Any } - localTable["remoteArtistDataSource-RemoteArtistDataSourceImpl"] = { [unowned self] in self.remoteArtistDataSource as Any } - localTable["artistRepository-any ArtistRepository"] = { [unowned self] in self.artistRepository as Any } - localTable["fetchArtistListUseCase-any FetchArtistListUseCase"] = { [unowned self] in self.fetchArtistListUseCase as Any } - localTable["artistDetailComponent-ArtistDetailComponent"] = { [unowned self] in self.artistDetailComponent as Any } - localTable["fetchArtistSongListUseCase-any FetchArtistSongListUseCase"] = { [unowned self] in self.fetchArtistSongListUseCase as Any } - localTable["artistMusicComponent-ArtistMusicComponent"] = { [unowned self] in self.artistMusicComponent as Any } - localTable["artistMusicContentComponent-ArtistMusicContentComponent"] = { [unowned self] in self.artistMusicContentComponent as Any } - localTable["profilePopComponent-ProfilePopComponent"] = { [unowned self] in self.profilePopComponent as Any } - localTable["favoriteComponent-FavoriteComponent"] = { [unowned self] in self.favoriteComponent as Any } - localTable["remoteUserDataSource-any RemoteUserDataSource"] = { [unowned self] in self.remoteUserDataSource as Any } - localTable["userRepository-any UserRepository"] = { [unowned self] in self.userRepository as Any } - localTable["fetchProfileListUseCase-any FetchProfileListUseCase"] = { [unowned self] in self.fetchProfileListUseCase as Any } - localTable["setProfileUseCase-any SetProfileUseCase"] = { [unowned self] in self.setProfileUseCase as Any } - localTable["setUserNameUseCase-any SetUserNameUseCase"] = { [unowned self] in self.setUserNameUseCase as Any } - localTable["fetchPlayListUseCase-any FetchPlayListUseCase"] = { [unowned self] in self.fetchPlayListUseCase as Any } - localTable["fetchFavoriteSongsUseCase-any FetchFavoriteSongsUseCase"] = { [unowned self] in self.fetchFavoriteSongsUseCase as Any } - localTable["editFavoriteSongsOrderUseCase-any EditFavoriteSongsOrderUseCase"] = { [unowned self] in self.editFavoriteSongsOrderUseCase as Any } - localTable["editPlayListOrderUseCase-any EditPlayListOrderUseCase"] = { [unowned self] in self.editPlayListOrderUseCase as Any } - localTable["deletePlayListUseCase-any DeletePlayListUseCase"] = { [unowned self] in self.deletePlayListUseCase as Any } - localTable["deleteFavoriteListUseCase-any DeleteFavoriteListUseCase"] = { [unowned self] in self.deleteFavoriteListUseCase as Any } - localTable["fetchUserInfoUseCase-any FetchUserInfoUseCase"] = { [unowned self] in self.fetchUserInfoUseCase as Any } - localTable["withdrawUserInfoUseCase-any WithdrawUserInfoUseCase"] = { [unowned self] in self.withdrawUserInfoUseCase as Any } - localTable["mainContainerComponent-MainContainerComponent"] = { [unowned self] in self.mainContainerComponent as Any } - localTable["bottomTabBarComponent-BottomTabBarComponent"] = { [unowned self] in self.bottomTabBarComponent as Any } - localTable["mainTabBarComponent-MainTabBarComponent"] = { [unowned self] in self.mainTabBarComponent as Any } - localTable["playerComponent-PlayerComponent"] = { [unowned self] in self.playerComponent as Any } - localTable["playlistComponent-PlaylistComponent"] = { [unowned self] in self.playlistComponent as Any } - localTable["openSourceLicenseComponent-OpenSourceLicenseComponent"] = { [unowned self] in self.openSourceLicenseComponent as Any } - localTable["serviceInfoComponent-ServiceInfoComponent"] = { [unowned self] in self.serviceInfoComponent as Any } - localTable["permissionComponent-PermissionComponent"] = { [unowned self] in self.permissionComponent as Any } - localTable["noticePopupComponent-NoticePopupComponent"] = { [unowned self] in self.noticePopupComponent as Any } - localTable["noticeComponent-NoticeComponent"] = { [unowned self] in self.noticeComponent as Any } - localTable["noticeDetailComponent-NoticeDetailComponent"] = { [unowned self] in self.noticeDetailComponent as Any } - localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { [unowned self] in self.remoteNoticeDataSource as Any } - 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["multiPurposePopUpFactory-any MultiPurposePopUpFactory"] = { [unowned self] in self.multiPurposePopUpFactory as Any } - localTable["textPopUpFactory-any TextPopUpFactory"] = { [unowned self] in self.textPopUpFactory as Any } - localTable["containSongsFactory-any ContainSongsFactory"] = { [unowned self] in self.containSongsFactory as Any } - localTable["privacyComponent-PrivacyComponent"] = { [unowned self] in self.privacyComponent as Any } - localTable["serviceTermsComponent-ServiceTermsComponent"] = { [unowned self] in self.serviceTermsComponent as Any } - localTable["questionComponent-QuestionComponent"] = { [unowned self] in self.questionComponent 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["fetchAppCheckUseCase-any FetchAppCheckUseCase"] = { [unowned self] in self.fetchAppCheckUseCase as Any } - localTable["chartComponent-ChartComponent"] = { [unowned self] in self.chartComponent as Any } - localTable["chartContentComponent-ChartContentComponent"] = { [unowned self] in self.chartContentComponent as Any } - localTable["remoteChartDataSource-any RemoteChartDataSource"] = { [unowned self] in self.remoteChartDataSource as Any } - localTable["chartRepository-any ChartRepository"] = { [unowned self] in self.chartRepository as Any } - localTable["fetchChartRankingUseCase-any FetchChartRankingUseCase"] = { [unowned self] in self.fetchChartRankingUseCase as Any } + localTable["keychain-any Keychain"] = { self.keychain as Any } + localTable["homeComponent-HomeComponent"] = { self.homeComponent as Any } + localTable["newSongsComponent-NewSongsComponent"] = { self.newSongsComponent as Any } + localTable["newSongsContentComponent-NewSongsContentComponent"] = { self.newSongsContentComponent as Any } + localTable["lyricHighlightingFactory-any LyricHighlightingFactory"] = { self.lyricHighlightingFactory as Any } + localTable["lyricDecoratingComponent-LyricDecoratingComponent"] = { self.lyricDecoratingComponent as Any } + localTable["remoteSongsDataSource-any RemoteSongsDataSource"] = { self.remoteSongsDataSource as Any } + localTable["songsRepository-any SongsRepository"] = { self.songsRepository as Any } + localTable["fetchSongUseCase-any FetchSongUseCase"] = { self.fetchSongUseCase as Any } + localTable["fetchLyricsUseCase-any FetchLyricsUseCase"] = { self.fetchLyricsUseCase as Any } + localTable["fetchNewSongsUseCase-any FetchNewSongsUseCase"] = { self.fetchNewSongsUseCase as Any } + localTable["signInFactory-any SignInFactory"] = { self.signInFactory as Any } + localTable["storageFactory-any StorageFactory"] = { self.storageFactory as Any } + localTable["requestComponent-RequestComponent"] = { self.requestComponent as Any } + localTable["localAuthDataSource-any LocalAuthDataSource"] = { self.localAuthDataSource as Any } + localTable["remoteAuthDataSource-any RemoteAuthDataSource"] = { self.remoteAuthDataSource as Any } + localTable["authRepository-any AuthRepository"] = { self.authRepository as Any } + localTable["fetchTokenUseCase-any FetchTokenUseCase"] = { self.fetchTokenUseCase as Any } + localTable["fetchNaverUserInfoUseCase-any FetchNaverUserInfoUseCase"] = { self.fetchNaverUserInfoUseCase as Any } + localTable["logoutUseCase-any LogoutUseCase"] = { self.logoutUseCase as Any } + localTable["checkIsExistAccessTokenUseCase-any CheckIsExistAccessTokenUseCase"] = { self.checkIsExistAccessTokenUseCase as Any } + localTable["remoteLikeDataSource-any RemoteLikeDataSource"] = { self.remoteLikeDataSource as Any } + localTable["likeRepository-any LikeRepository"] = { self.likeRepository as Any } + localTable["fetchLikeNumOfSongUseCase-any FetchLikeNumOfSongUseCase"] = { self.fetchLikeNumOfSongUseCase as Any } + localTable["addLikeSongUseCase-any AddLikeSongUseCase"] = { self.addLikeSongUseCase as Any } + localTable["cancelLikeSongUseCase-any CancelLikeSongUseCase"] = { self.cancelLikeSongUseCase as Any } + localTable["playlistDetailFactory-any PlaylistDetailFactory"] = { self.playlistDetailFactory as Any } + localTable["myPlayListComponent-MyPlayListComponent"] = { self.myPlayListComponent as Any } + localTable["remotePlayListDataSource-any RemotePlayListDataSource"] = { self.remotePlayListDataSource as Any } + localTable["playListRepository-any PlayListRepository"] = { self.playListRepository as Any } + localTable["fetchRecommendPlayListUseCase-any FetchRecommendPlayListUseCase"] = { self.fetchRecommendPlayListUseCase as Any } + localTable["fetchPlayListDetailUseCase-any FetchPlayListDetailUseCase"] = { self.fetchPlayListDetailUseCase as Any } + localTable["createPlayListUseCase-any CreatePlayListUseCase"] = { self.createPlayListUseCase as Any } + localTable["updatePlaylistUseCase-any UpdatePlaylistUseCase"] = { self.updatePlaylistUseCase as Any } + localTable["updateTitleAndPrivateUseCase-any UpdateTitleAndPrivateUseCase"] = { self.updateTitleAndPrivateUseCase as Any } + localTable["addSongIntoPlayListUseCase-any AddSongIntoPlayListUseCase"] = { self.addSongIntoPlayListUseCase as Any } + localTable["removeSongsUseCase-any RemoveSongsUseCase"] = { self.removeSongsUseCase as Any } + localTable["uploadPlaylistImageUseCase-any UploadPlaylistImageUseCase"] = { self.uploadPlaylistImageUseCase as Any } + localTable["artistComponent-ArtistComponent"] = { self.artistComponent as Any } + localTable["remoteArtistDataSource-RemoteArtistDataSourceImpl"] = { self.remoteArtistDataSource as Any } + localTable["artistRepository-any ArtistRepository"] = { self.artistRepository as Any } + localTable["fetchArtistListUseCase-any FetchArtistListUseCase"] = { self.fetchArtistListUseCase as Any } + localTable["artistDetailComponent-ArtistDetailComponent"] = { self.artistDetailComponent as Any } + localTable["fetchArtistSongListUseCase-any FetchArtistSongListUseCase"] = { self.fetchArtistSongListUseCase as Any } + localTable["artistMusicComponent-ArtistMusicComponent"] = { self.artistMusicComponent as Any } + localTable["artistMusicContentComponent-ArtistMusicContentComponent"] = { self.artistMusicContentComponent as Any } + localTable["profilePopComponent-ProfilePopComponent"] = { self.profilePopComponent as Any } + localTable["favoriteComponent-FavoriteComponent"] = { self.favoriteComponent as Any } + localTable["remoteUserDataSource-any RemoteUserDataSource"] = { self.remoteUserDataSource as Any } + localTable["userRepository-any UserRepository"] = { self.userRepository as Any } + localTable["fetchProfileListUseCase-any FetchProfileListUseCase"] = { self.fetchProfileListUseCase as Any } + localTable["setProfileUseCase-any SetProfileUseCase"] = { self.setProfileUseCase as Any } + localTable["setUserNameUseCase-any SetUserNameUseCase"] = { self.setUserNameUseCase as Any } + localTable["fetchPlayListUseCase-any FetchPlayListUseCase"] = { self.fetchPlayListUseCase as Any } + localTable["fetchFavoriteSongsUseCase-any FetchFavoriteSongsUseCase"] = { self.fetchFavoriteSongsUseCase as Any } + localTable["editFavoriteSongsOrderUseCase-any EditFavoriteSongsOrderUseCase"] = { self.editFavoriteSongsOrderUseCase as Any } + localTable["editPlayListOrderUseCase-any EditPlayListOrderUseCase"] = { self.editPlayListOrderUseCase as Any } + localTable["deletePlayListUseCase-any DeletePlayListUseCase"] = { self.deletePlayListUseCase as Any } + localTable["deleteFavoriteListUseCase-any DeleteFavoriteListUseCase"] = { self.deleteFavoriteListUseCase as Any } + localTable["fetchUserInfoUseCase-any FetchUserInfoUseCase"] = { self.fetchUserInfoUseCase as Any } + localTable["withdrawUserInfoUseCase-any WithdrawUserInfoUseCase"] = { self.withdrawUserInfoUseCase as Any } + localTable["mainContainerComponent-MainContainerComponent"] = { self.mainContainerComponent as Any } + localTable["bottomTabBarComponent-BottomTabBarComponent"] = { self.bottomTabBarComponent as Any } + localTable["mainTabBarComponent-MainTabBarComponent"] = { self.mainTabBarComponent as Any } + localTable["playerComponent-PlayerComponent"] = { self.playerComponent as Any } + localTable["playlistComponent-PlaylistComponent"] = { self.playlistComponent as Any } + localTable["openSourceLicenseComponent-OpenSourceLicenseComponent"] = { self.openSourceLicenseComponent as Any } + localTable["serviceInfoComponent-ServiceInfoComponent"] = { self.serviceInfoComponent as Any } + localTable["permissionComponent-PermissionComponent"] = { self.permissionComponent as Any } + localTable["noticePopupComponent-NoticePopupComponent"] = { self.noticePopupComponent as Any } + localTable["noticeComponent-NoticeComponent"] = { self.noticeComponent as Any } + localTable["noticeDetailComponent-NoticeDetailComponent"] = { self.noticeDetailComponent as Any } + localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { self.remoteNoticeDataSource as Any } + localTable["noticeRepository-any NoticeRepository"] = { self.noticeRepository as Any } + localTable["fetchNoticeUseCase-any FetchNoticeUseCase"] = { self.fetchNoticeUseCase as Any } + localTable["fetchNoticeCategoriesUseCase-any FetchNoticeCategoriesUseCase"] = { self.fetchNoticeCategoriesUseCase as Any } + localTable["multiPurposePopUpFactory-any MultiPurposePopUpFactory"] = { self.multiPurposePopUpFactory as Any } + localTable["textPopUpFactory-any TextPopUpFactory"] = { self.textPopUpFactory as Any } + localTable["containSongsFactory-any ContainSongsFactory"] = { self.containSongsFactory as Any } + localTable["privacyComponent-PrivacyComponent"] = { self.privacyComponent as Any } + localTable["serviceTermsComponent-ServiceTermsComponent"] = { self.serviceTermsComponent as Any } + localTable["questionComponent-QuestionComponent"] = { self.questionComponent as Any } + localTable["faqComponent-FaqComponent"] = { self.faqComponent as Any } + localTable["faqContentComponent-FaqContentComponent"] = { self.faqContentComponent as Any } + localTable["remoteFaqDataSource-any RemoteFaqDataSource"] = { self.remoteFaqDataSource as Any } + localTable["faqRepository-any FaqRepository"] = { self.faqRepository as Any } + localTable["fetchFaqCategoriesUseCase-any FetchFaqCategoriesUseCase"] = { self.fetchFaqCategoriesUseCase as Any } + localTable["fetchFaqUseCase-any FetchFaqUseCase"] = { self.fetchFaqUseCase as Any } + localTable["remoteAppDataSource-any RemoteAppDataSource"] = { self.remoteAppDataSource as Any } + localTable["appRepository-any AppRepository"] = { self.appRepository as Any } + localTable["fetchAppCheckUseCase-any FetchAppCheckUseCase"] = { self.fetchAppCheckUseCase as Any } + localTable["chartComponent-ChartComponent"] = { self.chartComponent as Any } + localTable["chartContentComponent-ChartContentComponent"] = { self.chartContentComponent as Any } + localTable["remoteChartDataSource-any RemoteChartDataSource"] = { self.remoteChartDataSource as Any } + localTable["chartRepository-any ChartRepository"] = { self.chartRepository as Any } + localTable["fetchChartRankingUseCase-any FetchChartRankingUseCase"] = { self.fetchChartRankingUseCase as Any } } } extension ArtistComponent: Registration { diff --git a/Projects/Domains/SongsDomain/Interface/DataSource/RemoteSongsDataSource.swift b/Projects/Domains/SongsDomain/Interface/DataSource/RemoteSongsDataSource.swift index ab6070c6a..e7a41c641 100644 --- a/Projects/Domains/SongsDomain/Interface/DataSource/RemoteSongsDataSource.swift +++ b/Projects/Domains/SongsDomain/Interface/DataSource/RemoteSongsDataSource.swift @@ -2,7 +2,8 @@ import Foundation import RxSwift public protocol RemoteSongsDataSource { + func fetchSong(id: String) -> Single func fetchLyrics(id: String) -> Single<[LyricsEntity]> - func fetchSongCredits(id: String) -> Single + func fetchSongCredits(id: String) -> Single<[SongCreditsEntity]> func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> } diff --git a/Projects/Domains/SongsDomain/Interface/Entity/SongCreditsEntity.swift b/Projects/Domains/SongsDomain/Interface/Entity/SongCreditsEntity.swift index 77ef6ba47..1cbab5269 100644 --- a/Projects/Domains/SongsDomain/Interface/Entity/SongCreditsEntity.swift +++ b/Projects/Domains/SongsDomain/Interface/Entity/SongCreditsEntity.swift @@ -10,40 +10,13 @@ import Foundation public struct SongCreditsEntity { public init( - vocal: [String], - featuring: [String], - original: String, - producing: [String], - lyrics: [String], - relyrics: [String], - compose: [String], - arrange: [String], - mixing: [String], - mastering: [String], - session: [String], - chorus: [String], - vocalGuide: [String], - trainer: [String] + type: String, + names: [String] ) { - self.vocal = vocal - self.featuring = featuring - self.original = original - self.producing = producing - self.lyrics = lyrics - self.relyrics = relyrics - self.compose = compose - self.arrange = arrange - self.mixing = mixing - self.mastering = mastering - self.session = session - self.chorus = chorus - self.vocalGuide = vocalGuide - self.trainer = trainer + self.type = type + self.names = names } - public let vocal, featuring: [String] - public let original: String - public let producing, lyrics, relyrics, compose: [String] - public let arrange, mixing, mastering, session: [String] - public let chorus, vocalGuide, trainer: [String] + public let type: String + public let names: [String] } diff --git a/Projects/Domains/SongsDomain/Interface/Entity/SongEntity.swift b/Projects/Domains/SongsDomain/Interface/Entity/SongEntity.swift index bba73a556..c2aff8cfd 100644 --- a/Projects/Domains/SongsDomain/Interface/Entity/SongEntity.swift +++ b/Projects/Domains/SongsDomain/Interface/Entity/SongEntity.swift @@ -10,7 +10,8 @@ public struct SongEntity: Hashable, Equatable { views: Int, last: Int, date: String, - isSelected: Bool = false + isSelected: Bool = false, + karaokeNumber: SongEntity.KaraokeNumber = .init(TJ: nil, KY: nil) ) { self.id = id self.title = title @@ -21,6 +22,7 @@ public struct SongEntity: Hashable, Equatable { self.last = last self.date = date self.isSelected = isSelected + self.karaokeNumber = karaokeNumber } public let id, title, artist, remix: String @@ -28,6 +30,7 @@ public struct SongEntity: Hashable, Equatable { public let views, last: Int public let date: String public var isSelected: Bool + public let karaokeNumber: SongEntity.KaraokeNumber public func hash(into hasher: inout Hasher) { hasher.combine(id) @@ -37,3 +40,14 @@ public struct SongEntity: Hashable, Equatable { lhs.id == rhs.id } } + +public extension SongEntity { + struct KaraokeNumber { + public init (TJ: Int?, KY: Int?) { + self.TJ = TJ + self.KY = KY + } + + public let TJ, KY: Int? + } +} diff --git a/Projects/Domains/SongsDomain/Interface/Repository/SongsRepository.swift b/Projects/Domains/SongsDomain/Interface/Repository/SongsRepository.swift index 02d1b8b02..752f2315d 100644 --- a/Projects/Domains/SongsDomain/Interface/Repository/SongsRepository.swift +++ b/Projects/Domains/SongsDomain/Interface/Repository/SongsRepository.swift @@ -2,7 +2,8 @@ import Foundation import RxSwift public protocol SongsRepository { + func fetchSong(id: String) -> Single func fetchLyrics(id: String) -> Single<[LyricsEntity]> - func fetchSongCredits(id: String) -> Single + func fetchSongCredits(id: String) -> Single<[SongCreditsEntity]> func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> } diff --git a/Projects/Domains/SongsDomain/Interface/UseCase/fetchNewSongsUseCase.swift b/Projects/Domains/SongsDomain/Interface/UseCase/FetchNewSongsUseCase.swift similarity index 100% rename from Projects/Domains/SongsDomain/Interface/UseCase/fetchNewSongsUseCase.swift rename to Projects/Domains/SongsDomain/Interface/UseCase/FetchNewSongsUseCase.swift diff --git a/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongCreditsUseCase.swift b/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongCreditsUseCase.swift index 5e09c657e..716227c6b 100644 --- a/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongCreditsUseCase.swift +++ b/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongCreditsUseCase.swift @@ -10,5 +10,5 @@ import Foundation import RxSwift public protocol FetchSongCreditsUseCase { - func execute(id: String) -> Single + func execute(id: String) -> Single<[SongCreditsEntity]> } diff --git a/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongUseCase.swift b/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongUseCase.swift new file mode 100644 index 000000000..d952e637d --- /dev/null +++ b/Projects/Domains/SongsDomain/Interface/UseCase/FetchSongUseCase.swift @@ -0,0 +1,6 @@ +import Foundation +import RxSwift + +public protocol FetchSongUseCase { + func execute(id: String) -> Single +} diff --git a/Projects/Domains/SongsDomain/Sources/API/SongsAPI.swift b/Projects/Domains/SongsDomain/Sources/API/SongsAPI.swift index 58728b945..8a851a4a0 100644 --- a/Projects/Domains/SongsDomain/Sources/API/SongsAPI.swift +++ b/Projects/Domains/SongsDomain/Sources/API/SongsAPI.swift @@ -5,6 +5,7 @@ import Moya import SongsDomainInterface public enum SongsAPI { + case fetchSong(id: String) case fetchLyrics(id: String) case fetchCredits(id: String) case fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) @@ -17,6 +18,8 @@ extension SongsAPI: WMAPI { public var urlPath: String { switch self { + case let .fetchSong(id): + return "/\(id)" case let .fetchLyrics(id): return "/\(id)/lyrics" case let .fetchCredits(id): @@ -32,7 +35,7 @@ extension SongsAPI: WMAPI { public var task: Moya.Task { switch self { - case .fetchLyrics, .fetchCredits: + case .fetchSong, .fetchLyrics, .fetchCredits: return .requestPlain case let .fetchNewSongs(_, page, limit): diff --git a/Projects/Domains/SongsDomain/Sources/DataSource/RemoteSongsDataSourceImpl.swift b/Projects/Domains/SongsDomain/Sources/DataSource/RemoteSongsDataSourceImpl.swift index ab618e9c3..69e2f4c27 100644 --- a/Projects/Domains/SongsDomain/Sources/DataSource/RemoteSongsDataSourceImpl.swift +++ b/Projects/Domains/SongsDomain/Sources/DataSource/RemoteSongsDataSourceImpl.swift @@ -4,16 +4,22 @@ import RxSwift import SongsDomainInterface public final class RemoteSongsDataSourceImpl: BaseRemoteDataSource, RemoteSongsDataSource { + public func fetchSong(id: String) -> Single { + request(.fetchSong(id: id)) + .map(SingleSongResponseDTO.self) + .map { $0.toDomain() } + } + public func fetchLyrics(id: String) -> Single<[LyricsEntity]> { request(.fetchLyrics(id: id)) .map([LyricsResponseDTO].self) .map { $0.map { $0.toDomain() }} } - public func fetchSongCredits(id: String) -> Single { + public func fetchSongCredits(id: String) -> Single<[SongCreditsEntity]> { request(.fetchCredits(id: id)) - .map(SongCreditsResponseDTO.self) - .map { $0.toDomain() } + .map([SongCreditsResponseDTO].self) + .map { $0.map { $0.toDomain() }} } public func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> { diff --git a/Projects/Domains/SongsDomain/Sources/Repository/SongsRepositoryImpl.swift b/Projects/Domains/SongsDomain/Sources/Repository/SongsRepositoryImpl.swift index 66bb5fc27..776067917 100644 --- a/Projects/Domains/SongsDomain/Sources/Repository/SongsRepositoryImpl.swift +++ b/Projects/Domains/SongsDomain/Sources/Repository/SongsRepositoryImpl.swift @@ -10,11 +10,15 @@ public final class SongsRepositoryImpl: SongsRepository { self.remoteSongsDataSource = remoteSongsDataSource } + public func fetchSong(id: String) -> Single { + remoteSongsDataSource.fetchSong(id: id) + } + public func fetchLyrics(id: String) -> Single<[LyricsEntity]> { remoteSongsDataSource.fetchLyrics(id: id) } - public func fetchSongCredits(id: String) -> Single { + public func fetchSongCredits(id: String) -> Single<[SongCreditsEntity]> { remoteSongsDataSource.fetchSongCredits(id: id) } diff --git a/Projects/Domains/SongsDomain/Sources/ResponseDTO/SingleSongResponseDTO.swift b/Projects/Domains/SongsDomain/Sources/ResponseDTO/SingleSongResponseDTO.swift index 5088d85aa..35a35b535 100644 --- a/Projects/Domains/SongsDomain/Sources/ResponseDTO/SingleSongResponseDTO.swift +++ b/Projects/Domains/SongsDomain/Sources/ResponseDTO/SingleSongResponseDTO.swift @@ -14,10 +14,18 @@ public struct SingleSongResponseDTO: Decodable { public let songID, title: String public let artists: [String] public let date, views, likes: Int + public let karaokeNumber: SingleSongResponseDTO.KaraokeNumber enum CodingKeys: String, CodingKey { case title, artists, date, views, likes case songID = "videoId" + case karaokeNumber + } +} + +public extension SingleSongResponseDTO { + struct KaraokeNumber: Decodable { + public let TJ, KY: Int? } } @@ -31,7 +39,8 @@ public extension SingleSongResponseDTO { reaction: "", views: views, last: 0, - date: date.changeDateFormat(origin: "yyMMdd", result: "yyyy.MM.dd") + date: date.changeDateFormat(origin: "yyMMdd", result: "yyyy.MM.dd"), + karaokeNumber: .init(TJ: karaokeNumber.TJ, KY: karaokeNumber.KY) ) } } diff --git a/Projects/Domains/SongsDomain/Sources/ResponseDTO/SongCreditsResponseDTO.swift b/Projects/Domains/SongsDomain/Sources/ResponseDTO/SongCreditsResponseDTO.swift index c347dbd2f..49d31d94c 100644 --- a/Projects/Domains/SongsDomain/Sources/ResponseDTO/SongCreditsResponseDTO.swift +++ b/Projects/Domains/SongsDomain/Sources/ResponseDTO/SongCreditsResponseDTO.swift @@ -10,30 +10,15 @@ import Foundation import SongsDomainInterface public struct SongCreditsResponseDTO: Decodable { - let vocal, featuring: [String] - let original: String - let producing, lyrics, relyrics, compose: [String] - let arrange, mixing, mastering, session: [String] - let chorus, vocalGuide, trainer: [String] + let type: String + let names: [String] } public extension SongCreditsResponseDTO { func toDomain() -> SongCreditsEntity { return SongCreditsEntity( - vocal: vocal, - featuring: featuring, - original: original, - producing: producing, - lyrics: lyrics, - relyrics: relyrics, - compose: compose, - arrange: arrange, - mixing: mixing, - mastering: mastering, - session: session, - chorus: chorus, - vocalGuide: vocalGuide, - trainer: trainer + type: type, + names: names ) } } diff --git a/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongCreditsUseCaseImpl.swift b/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongCreditsUseCaseImpl.swift index 3133895f6..fc26155a1 100644 --- a/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongCreditsUseCaseImpl.swift +++ b/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongCreditsUseCaseImpl.swift @@ -18,7 +18,7 @@ public struct FetchSongCreditsUseCaseImpl: FetchSongCreditsUseCase { self.songsRepository = songsRepository } - public func execute(id: String) -> RxSwift.Single { + public func execute(id: String) -> Single<[SongCreditsEntity]> { songsRepository.fetchSongCredits(id: id) } } diff --git a/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongUseCaseImpl.swift b/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongUseCaseImpl.swift new file mode 100644 index 000000000..731b2f8bd --- /dev/null +++ b/Projects/Domains/SongsDomain/Sources/UseCase/FetchSongUseCaseImpl.swift @@ -0,0 +1,16 @@ +import RxSwift +import SongsDomainInterface + +public struct FetchSongUseCaseImpl: FetchSongUseCase { + private let songsRepository: any SongsRepository + + public init( + songsRepository: SongsRepository + ) { + self.songsRepository = songsRepository + } + + public func execute(id: String) -> Single { + songsRepository.fetchSong(id: id) + } +}