Skip to content

Commit 4fc9a70

Browse files
authored
Merge pull request #69 from boostcampwm-2024/feat/#47-make-event-hub
[FEAT/#47] 이벤트 허브를 만든다
2 parents ae00db5 + 1e9552d commit 4fc9a70

File tree

22 files changed

+269
-92
lines changed

22 files changed

+269
-92
lines changed

PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/StickerDTO.swift renamed to PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/EmojiDTO.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import PhotoGetherDomainInterface
33

4-
public struct StickerDTO: Decodable {
4+
public struct EmojiDTO: Decodable {
55
let code: String
66
let character: String
77
let image: String
@@ -10,8 +10,8 @@ public struct StickerDTO: Decodable {
1010
let subgroup: String
1111
}
1212

13-
extension StickerDTO {
14-
func toEntity() -> StickerEntity {
13+
extension EmojiDTO {
14+
func toEntity() -> EmojiEntity {
1515
return .init(
1616
image: self.image,
1717
name: self.name

PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/LocalShapeDataSourceImpl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
import PhotoGetherDomainInterface
44

55
public final class LocalShapeDataSourceImpl: ShapeDataSource {
6-
public func fetchStickerData() -> AnyPublisher<[StickerDTO], Error> {
6+
public func fetchEmojiData() -> AnyPublisher<[EmojiDTO], Error> {
77
return Empty().eraseToAnyPublisher()
88
}
99

PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/RemoteShapeDataSourceImpl.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import PhotoGetherNetwork
44

55
public final class RemoteShapeDataSourceImpl: ShapeDataSource {
66
// TODO: 페이징 적용 필요
7-
public func fetchStickerData() -> AnyPublisher<[StickerDTO], Error> {
8-
return Request.requestJSON(StickerEndPoint())
7+
public func fetchEmojiData() -> AnyPublisher<[EmojiDTO], Error> {
8+
return Request.requestJSON(EmojiEndPoint())
99
}
1010

1111
public init() { }
1212
}
1313

14-
private struct StickerEndPoint: EndPoint {
14+
private struct EmojiEndPoint: EndPoint {
1515
var baseURL: URL { URL(string: "https://api.api-ninjas.com")! }
1616
var path: String { "v1/emoji" }
1717
var method: HTTPMethod { .get }

PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/ShapeDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import Combine
22
import Foundation
33

44
public protocol ShapeDataSource {
5-
func fetchStickerData() -> AnyPublisher<[StickerDTO], Error>
5+
func fetchEmojiData() -> AnyPublisher<[EmojiDTO], Error>
66
}

PhotoGether/DataLayer/PhotoGetherData/PhotoGetherData/ShapeRepositoryImpl.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import PhotoGetherDomainInterface
55
final public class ShapeRepositoryImpl: ShapeRepository {
66
// TODO: local 먼저 확인 -> remote 데이터 확인하도록 수정
77
// MARK: JSON 데이터 내부의 URL을 어느 시점에 다운로드 할것인가...?
8-
public func fetchStickerList() -> AnyPublisher<[StickerEntity], Never> {
9-
return remoteDataSource.fetchStickerData()
8+
public func fetchEmojiList() -> AnyPublisher<[EmojiEntity], Never> {
9+
return remoteDataSource.fetchEmojiData()
1010
.map { $0.map { $0.toEntity() } }
1111
.replaceError(with: [])
1212
.eraseToAnyPublisher()
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import PhotoGetherDomainTesting
33
import PhotoGetherDomainInterface
44
import PhotoGetherDomain
55

6-
final class FetchStickerListUseCaseTests: XCTestCase {
7-
var sut: FetchStickerListUseCase!
6+
final class FetchEmojiListUseCaseTests: XCTestCase {
7+
var sut: FetchEmojiListUseCase!
88
var shapeRepositoryMock: ShapeRepositoryMock!
99

1010
func test_이미지데이터_리스트를_번들에서_잘_가져오는지() {
@@ -26,15 +26,15 @@ final class FetchStickerListUseCaseTests: XCTestCase {
2626
]
2727
let shapeRepositoryMock = ShapeRepositoryMock(imageNameList: imageNameList)
2828

29-
sut = FetchStickerListUseCaseImpl(shapeRepository: shapeRepositoryMock)
29+
sut = FetchEmojiListUseCaseImpl(shapeRepository: shapeRepositoryMock)
3030

31-
var targetEntityList: [StickerEntity] = []
31+
var targetEntityList: [EmojiEntity] = []
3232
let beforeEntityListCount = 0
3333

3434
//Act 실행 단계: SUT 메소드를 호출하면서 의존성을 전달해서 결과를 저장하기
3535
let cancellable = sut.execute()
36-
.sink { stickerEntities in
37-
targetEntityList.append(contentsOf: stickerEntities)
36+
.sink { emojiEntities in
37+
targetEntityList.append(contentsOf: emojiEntities)
3838
expectation.fulfill()
3939
}
4040

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Combine
22
import Foundation
33
import PhotoGetherDomainInterface
44

5-
public final class FetchStickerListUseCaseImpl: FetchStickerListUseCase {
6-
public func execute() -> AnyPublisher<[StickerEntity], Never> {
7-
return shapeRepository.fetchStickerList()
5+
public final class FetchEmojiListUseCaseImpl: FetchEmojiListUseCase {
6+
public func execute() -> AnyPublisher<[EmojiEntity], Never> {
7+
return shapeRepository.fetchEmojiList()
88
}
99

1010
private let shapeRepository: ShapeRepository
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public struct StickerEntity: Decodable {
3+
public struct EmojiEntity: Decodable {
44
public let image: String
55
public let name: String
66

PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomainInterface/Repository/ShapeRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import Combine
22
import Foundation
33

44
public protocol ShapeRepository {
5-
func fetchStickerList() -> AnyPublisher<[StickerEntity], Never>
5+
func fetchEmojiList() -> AnyPublisher<[EmojiEntity], Never>
66
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Combine
2+
import Foundation
3+
4+
public protocol FetchEmojiListUseCase {
5+
func execute() -> AnyPublisher<[EmojiEntity], Never>
6+
}

0 commit comments

Comments
 (0)