diff --git a/Projects/Core/PPACData/Sources/Endpoint/MemeEndpoint.swift b/Projects/Core/PPACData/Sources/Endpoint/MemeEndpoint.swift index a845369..a39dfe5 100644 --- a/Projects/Core/PPACData/Sources/Endpoint/MemeEndpoint.swift +++ b/Projects/Core/PPACData/Sources/Endpoint/MemeEndpoint.swift @@ -18,7 +18,7 @@ public enum MemeEndpoint: Requestable { case deleteBookmark(memeId: String) case share(memeId: String) case watch(memeId: String, type: String) - case reaction(memeId: String) + case reaction(memeId: String, count: Int) public var httpMethod: PPACNetwork.HTTPMethod { switch self { @@ -61,8 +61,8 @@ public enum MemeEndpoint: Requestable { return "/meme/\(memeId)/share" case .watch(let memeId, let type): return "/meme/\(memeId)/watch/\(type)" - case .reaction(let memeId): - return "/meme/\(memeId)/reaction" + case .reaction(let memeId, _): + return "meme/\(memeId)/reaction" } } @@ -85,8 +85,8 @@ public enum MemeEndpoint: Requestable { return nil case .watch: return nil - case .reaction: - return nil + case let .reaction(memeId, count): + return .body(MemeReactionRequestDTO(count: count)) case .meme(memeId: _): return nil } diff --git a/Projects/Core/PPACData/Sources/Repository/MemeRepositoryImpl.swift b/Projects/Core/PPACData/Sources/Repository/MemeRepositoryImpl.swift index c55da72..41079c1 100644 --- a/Projects/Core/PPACData/Sources/Repository/MemeRepositoryImpl.swift +++ b/Projects/Core/PPACData/Sources/Repository/MemeRepositoryImpl.swift @@ -114,8 +114,8 @@ public class MemeRepositoryImpl: MemeRepository { } } - public func reactToMeme(memeId: String) async throws { - let endpoint = MemeEndpoint.reaction(memeId: memeId) + public func reactToMeme(memeId: String, count: Int) async throws { + let endpoint = MemeEndpoint.reaction(memeId: memeId, count: count) let result = await networkservice.request(endpoint, dataType: BaseDTO.self) switch result { case .success: diff --git a/Projects/Core/PPACDomain/Sources/Repository/MemeRepository.swift b/Projects/Core/PPACDomain/Sources/Repository/MemeRepository.swift index a3a7eef..8d880c1 100644 --- a/Projects/Core/PPACDomain/Sources/Repository/MemeRepository.swift +++ b/Projects/Core/PPACDomain/Sources/Repository/MemeRepository.swift @@ -19,7 +19,7 @@ public protocol MemeRepository { func deleteBookmarkMeme(memeId: String) async throws func shareMeme(memeId: String) async throws func watchMeme(memeId: String, type: String) async throws - func reactToMeme(memeId: String) async throws + func reactToMeme(memeId: String, count: Int) async throws func registerMeme(formData: FormData, title: String, source: String, keywordIds: [String]) async throws } diff --git a/Projects/Core/PPACDomain/Sources/UseCase/Meme/ReactToMemeUseCase.swift b/Projects/Core/PPACDomain/Sources/UseCase/Meme/ReactToMemeUseCase.swift index 79858bd..26987bf 100644 --- a/Projects/Core/PPACDomain/Sources/UseCase/Meme/ReactToMemeUseCase.swift +++ b/Projects/Core/PPACDomain/Sources/UseCase/Meme/ReactToMemeUseCase.swift @@ -10,7 +10,7 @@ import Foundation import PPACModels public protocol ReactToMemeUseCase { - func execute(memeId: String) async throws + func execute(memeId: String, count: Int) async throws } public class ReactToMemeUseCaseImpl: ReactToMemeUseCase { @@ -20,7 +20,7 @@ public class ReactToMemeUseCaseImpl: ReactToMemeUseCase { self.repository = repository } - public func execute(memeId: String) async throws { - try await repository.reactToMeme(memeId: memeId) + public func execute(memeId: String, count: Int) async throws { + try await repository.reactToMeme(memeId: memeId, count: count) } }