diff --git a/Projects/App/Sources/Application/AppComponent+Songs.swift b/Projects/App/Sources/Application/AppComponent+Songs.swift index 2592b3852..795b82db8 100644 --- a/Projects/App/Sources/Application/AppComponent+Songs.swift +++ b/Projects/App/Sources/Application/AppComponent+Songs.swift @@ -62,12 +62,6 @@ public extension AppComponent { } } - var fetchNewSongUseCase: any FetchNewSongUseCase { - shared { - FetchNewSongUseCaseImpl(songsRepository: songsRepository) - } - } - var fetchNewSongsUseCase: any FetchNewSongsUseCase { shared { FetchNewSongsUseCaseImpl(songsRepository: songsRepository) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index e218c8147..dba6bc387 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -801,7 +801,6 @@ extension AppComponent: Registration { localTable["songsRepository-any SongsRepository"] = { self.songsRepository as Any } localTable["fetchSearchSongUseCase-any FetchSearchSongUseCase"] = { self.fetchSearchSongUseCase as Any } localTable["fetchLyricsUseCase-any FetchLyricsUseCase"] = { self.fetchLyricsUseCase as Any } - localTable["fetchNewSongUseCase-any FetchNewSongUseCase"] = { self.fetchNewSongUseCase as Any } localTable["fetchNewSongsUseCase-any FetchNewSongsUseCase"] = { self.fetchNewSongsUseCase as Any } localTable["signInComponent-SignInComponent"] = { self.signInComponent as Any } localTable["storageComponent-StorageComponent"] = { self.storageComponent as Any } diff --git a/Projects/Services/APIKit/Sources/API/SongsAPI.swift b/Projects/Services/APIKit/Sources/API/SongsAPI.swift index 350723840..75fe30485 100644 --- a/Projects/Services/APIKit/Sources/API/SongsAPI.swift +++ b/Projects/Services/APIKit/Sources/API/SongsAPI.swift @@ -5,7 +5,6 @@ import Foundation public enum SongsAPI { case fetchSearchSong(type: SearchType, keyword: String) - case fetchNewSong(type: NewSongGroupType) case fetchLyrics(id: String) case fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) } @@ -28,8 +27,6 @@ extension SongsAPI: WMAPI { switch self { case .fetchSearchSong: return "/search" - case let .fetchNewSong(type): - return "/new/\(type.apiKey)" case .fetchLyrics(id: let id): return "/lyrics/\(id)" case let .fetchNewSongs(type, _, _): @@ -50,7 +47,7 @@ extension SongsAPI: WMAPI { "keyword": keyword ], encoding: URLEncoding.queryString) - case .fetchLyrics, .fetchNewSong: + case .fetchLyrics: return .requestPlain case let .fetchNewSongs(_, page, limit): diff --git a/Projects/Services/DataMappingModule/Sources/Songs/Response/NewSongResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Songs/Response/NewSongResponseDTO.swift deleted file mode 100644 index e1cb87181..000000000 --- a/Projects/Services/DataMappingModule/Sources/Songs/Response/NewSongResponseDTO.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// NewSongResponseDTO.swift -// DataMappingModule -// -// Created by KTH on 2023/02/20. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import Foundation - -public struct NewSongResponseDTO: Decodable { - public let id, title, artist, remix: String - public let reaction: String - public let date: Int - public let total: NewSongResponseDTO.Total? - - public static func == (lhs: Self, rhs: Self) -> Bool { - return lhs.id == rhs.id - } - - enum CodingKeys: String, CodingKey { - case id = "songId" - case title, artist, remix, reaction, date, total - } -} - -public extension NewSongResponseDTO { - struct Total: Codable { - public let views: Int - public let last: Int - } -} diff --git a/Projects/Services/DataModule/Sources/Songs/Repositories/SongsRepositoryImpl.swift b/Projects/Services/DataModule/Sources/Songs/Repositories/SongsRepositoryImpl.swift index 630933fc8..f7001750f 100644 --- a/Projects/Services/DataModule/Sources/Songs/Repositories/SongsRepositoryImpl.swift +++ b/Projects/Services/DataModule/Sources/Songs/Repositories/SongsRepositoryImpl.swift @@ -22,10 +22,6 @@ public struct SongsRepositoryImpl: SongsRepository { remoteSongsDataSource.fetchLyrics(id: id) } - public func fetchNewSong(type: NewSongGroupType) -> Single<[NewSongEntity]> { - remoteSongsDataSource.fetchNewSong(type: type) - } - public func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> { remoteSongsDataSource.fetchNewSongs(type: type, page: page, limit: limit) } diff --git a/Projects/Services/DataModule/Sources/Songs/UseCases/FetchNewSongUseCaseImpl.swift b/Projects/Services/DataModule/Sources/Songs/UseCases/FetchNewSongUseCaseImpl.swift deleted file mode 100644 index 817cbc75c..000000000 --- a/Projects/Services/DataModule/Sources/Songs/UseCases/FetchNewSongUseCaseImpl.swift +++ /dev/null @@ -1,18 +0,0 @@ -import RxSwift -import DataMappingModule -import DomainModule -import ErrorModule - -public struct FetchNewSongUseCaseImpl: FetchNewSongUseCase { - private let songsRepository: any SongsRepository - - public init( - songsRepository: SongsRepository - ) { - self.songsRepository = songsRepository - } - - public func execute(type: NewSongGroupType) -> Single<[NewSongEntity]> { - songsRepository.fetchNewSong(type: type) - } -} diff --git a/Projects/Services/DomainModule/Sources/Songs/Entity/NewSongEntity.swift b/Projects/Services/DomainModule/Sources/Songs/Entity/NewSongEntity.swift deleted file mode 100644 index 9efd45f56..000000000 --- a/Projects/Services/DomainModule/Sources/Songs/Entity/NewSongEntity.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// NewSongEntity.swift -// DomainModule -// -// Created by KTH on 2023/02/20. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import Foundation - -public struct NewSongEntity: Equatable { - public init( - id: String, - title: String, - artist: String, - remix: String, - reaction: String, - views: Int, - last: Int, - date: Int - ) { - self.id = id - self.title = title - self.artist = artist - self.remix = remix - self.reaction = reaction - self.views = views - self.last = last - self.date = date - } - - public let id, title, artist, remix: String - public let reaction: String - public let views, last: Int - public let date: Int -} diff --git a/Projects/Services/DomainModule/Sources/Songs/Repository/SongsRepository.swift b/Projects/Services/DomainModule/Sources/Songs/Repository/SongsRepository.swift index bd80998e4..e3d37acc0 100644 --- a/Projects/Services/DomainModule/Sources/Songs/Repository/SongsRepository.swift +++ b/Projects/Services/DomainModule/Sources/Songs/Repository/SongsRepository.swift @@ -6,6 +6,5 @@ import Foundation public protocol SongsRepository { func fetchSearchSong(type: SearchType, keyword: String) -> Single<[SongEntity]> func fetchLyrics(id: String) -> Single<[LyricsEntity]> - func fetchNewSong(type: NewSongGroupType) -> Single<[NewSongEntity]> func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> } diff --git a/Projects/Services/DomainModule/Sources/Songs/UseCases/fetchNewSongUseCase.swift b/Projects/Services/DomainModule/Sources/Songs/UseCases/fetchNewSongUseCase.swift deleted file mode 100644 index 3136f7ece..000000000 --- a/Projects/Services/DomainModule/Sources/Songs/UseCases/fetchNewSongUseCase.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// fetchNewSongUseCase.swift -// DomainModule -// -// Created by KTH on 2023/02/20. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import Foundation -import DataMappingModule -import ErrorModule -import RxSwift - -public protocol FetchNewSongUseCase { - func execute(type: NewSongGroupType) -> Single<[NewSongEntity]> -} diff --git a/Projects/Services/NetworkModule/Sources/Songs/DataTransfer/FetchNewSongTransfer.swift b/Projects/Services/NetworkModule/Sources/Songs/DataTransfer/FetchNewSongTransfer.swift deleted file mode 100644 index c1eae30be..000000000 --- a/Projects/Services/NetworkModule/Sources/Songs/DataTransfer/FetchNewSongTransfer.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// FetchNewSongTransfer.swift -// NetworkModule -// -// Created by KTH on 2023/02/20. -// Copyright © 2023 yongbeomkwak. All rights reserved. -// - -import DataMappingModule -import DomainModule -import Utility - -public extension NewSongResponseDTO { - func toDomain() -> NewSongEntity { - NewSongEntity( - id: id, - title: title, - artist: artist, - remix: remix, - reaction: reaction, - views: total?.views ?? 0, - last: total?.last ?? 0, - date: date - ) - } -} diff --git a/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSource.swift b/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSource.swift index 3d5db8701..16abc2edd 100644 --- a/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSource.swift +++ b/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSource.swift @@ -6,7 +6,6 @@ import Foundation public protocol RemoteSongsDataSource { func fetchSearchSong(type: SearchType,keyword: String) -> Single<[SongEntity]> - func fetchNewSong(type: NewSongGroupType) -> Single<[NewSongEntity]> func fetchLyrics(id: String) -> Single<[LyricsEntity]> func fetchNewSongs(type: NewSongGroupType, page: Int, limit: Int) -> Single<[NewSongsEntity]> } diff --git a/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSourceImpl.swift index 63352141c..99643fe8d 100644 --- a/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSourceImpl.swift +++ b/Projects/Services/NetworkModule/Sources/Songs/Remote/RemoteSongsDataSourceImpl.swift @@ -13,12 +13,6 @@ public final class RemoteSongsDataSourceImpl: BaseRemoteDataSource, Re .map{$0.map{$0.toDomain()}} } - public func fetchNewSong(type: NewSongGroupType) -> Single<[NewSongEntity]> { - request(.fetchNewSong(type: type)) - .map([NewSongResponseDTO].self) - .map{$0.map{$0.toDomain()}} - } - public func fetchLyrics(id: String) -> Single<[LyricsEntity]> { request(.fetchLyrics(id: id)) .map([LyricsResponseDTO].self)