Skip to content

Commit 1f4ce48

Browse files
committed
refactor/#117: Comment API 레포지토리 인터페이스에서 DTO 파라미터 제거 및 임플에서 매핑 빌드테스트 확인
1 parent 0e85d9b commit 1f4ce48

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

Poppool/Poppool/DataLayer/RepositoryImpl/CommentAPIRepositoryImpl.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ final class CommentAPIRepositoryImpl: CommentAPIRepository {
1111
self.provider = provider
1212
}
1313

14-
func postCommentAdd(request: PostCommentRequestDTO) -> Completable {
15-
let endPoint = CommentAPIEndPoint.postCommentAdd(request: request)
14+
func postCommentAdd(popUpStoreId: Int64, content: String?, commentType: String?, imageUrlList: [String?]) -> Completable {
15+
let requestDTO = PostCommentRequestDTO(popUpStoreId: popUpStoreId, content: content, commentType: commentType, imageUrlList: imageUrlList)
16+
let endPoint = CommentAPIEndPoint.postCommentAdd(request: requestDTO)
1617
return provider.request(with: endPoint, interceptor: tokenInterceptor)
1718
}
1819

19-
func deleteComment(request: DeleteCommentRequestDTO) -> Completable {
20-
let endPoint = CommentAPIEndPoint.deleteComment(request: request)
20+
func deleteComment(popUpStoreId: Int64, commentId: Int64) -> Completable {
21+
let requestDTO = DeleteCommentRequestDTO(popUpStoreId: popUpStoreId, commentId: commentId)
22+
let endPoint = CommentAPIEndPoint.deleteComment(request: requestDTO)
2123
return provider.request(with: endPoint, interceptor: tokenInterceptor)
2224
}
2325

24-
func editComment(request: PutCommentRequestDTO) -> Completable {
25-
let endPoint = CommentAPIEndPoint.editComment(request: request)
26+
func editComment(popUpStoreId: Int64, commentId: Int64, content: String?, imageUrlList: [PutCommentImageDataRequestDTO]?) -> Completable {
27+
let requestDTO = PutCommentRequestDTO(popUpStoreId: popUpStoreId, commentId: commentId, content: content, imageUrlList: imageUrlList)
28+
let endPoint = CommentAPIEndPoint.editComment(request: requestDTO)
2629
return provider.request(with: endPoint, interceptor: tokenInterceptor)
2730
}
2831
}

Poppool/Poppool/DomainLayer/Domain/UseCaseImpl/CommentAPIUseCaseImpl.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import Foundation
33
import RxSwift
44

55
final class CommentAPIUseCaseImpl: CommentAPIUseCase {
6-
6+
77
private let repository: CommentAPIRepository
88

99
init(repository: CommentAPIRepository) {
1010
self.repository = repository
1111
}
1212

1313
func postCommentAdd(popUpStoreId: Int64, content: String?, commentType: String?, imageUrlList: [String?]) -> Completable {
14-
return repository.postCommentAdd(request: .init(popUpStoreId: popUpStoreId, content: content, commentType: commentType, imageUrlList: imageUrlList))
14+
return repository.postCommentAdd(popUpStoreId: popUpStoreId, content: content, commentType: commentType, imageUrlList: imageUrlList)
1515
}
1616

1717
func deleteComment(popUpStoreId: Int64, commentId: Int64) -> Completable {
18-
return repository.deleteComment(request: .init(popUpStoreId: popUpStoreId, commentId: commentId))
18+
return repository.deleteComment(popUpStoreId: popUpStoreId, commentId: commentId)
1919
}
2020

2121
func editComment(popUpStoreId: Int64, commentId: Int64, content: String?, imageUrlList: [PutCommentImageDataRequestDTO]?) -> Completable {
22-
return repository.editComment(request: .init(popUpStoreId: popUpStoreId, commentId: commentId, content: content, imageUrlList: imageUrlList))
22+
return repository.editComment(popUpStoreId: popUpStoreId, commentId: commentId, content: content, imageUrlList: imageUrlList)
2323
}
2424
}

Poppool/Poppool/DomainLayer/DomainInterface/Repository/CommentAPIRepository.swift

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@ import Foundation
33
import RxSwift
44

55
protocol CommentAPIRepository {
6-
func postCommentAdd(request: PostCommentRequestDTO) -> Completable
7-
func deleteComment(request: DeleteCommentRequestDTO) -> Completable
8-
func editComment(request: PutCommentRequestDTO) -> Completable
6+
func postCommentAdd(
7+
popUpStoreId: Int64,
8+
content: String?,
9+
commentType: String?,
10+
imageUrlList: [String?]
11+
) -> Completable
12+
13+
func deleteComment(
14+
popUpStoreId: Int64,
15+
commentId: Int64
16+
) -> Completable
17+
18+
func editComment(
19+
popUpStoreId: Int64,
20+
commentId: Int64,
21+
content: String?,
22+
imageUrlList: [PutCommentImageDataRequestDTO]?
23+
) -> Completable
924
}

Poppool/Poppool/DomainLayer/DomainInterface/UseCase/CommentAPIUseCase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import RxSwift
55
protocol CommentAPIUseCase {
66
func postCommentAdd(popUpStoreId: Int64, content: String?, commentType: String?, imageUrlList: [String?]) -> Completable
77
func deleteComment(popUpStoreId: Int64, commentId: Int64) -> Completable
8-
func editComment(popUpStoreId: Int64, commentId: Int64, content: String?, imageUrlList: [PutCommentImageDataRequestDTO]?) -> Completable
8+
func editComment(popUpStoreId: Int64, commentId: Int64, content: String?, imageUrlList: [String?]?) -> Completable
99
}

0 commit comments

Comments
 (0)