feat(creator): 커뮤니티 게시글 상세를 연결한다

This commit is contained in:
Yu Sung
2026-07-08 01:56:57 +09:00
parent f2d589eca2
commit c0369e6f58
23 changed files with 2187 additions and 138 deletions

View File

@@ -4,6 +4,9 @@ import Moya
enum CreatorChannelCommunityApi {
case getCommunity(creatorId: Int, page: Int, size: Int)
case getCommunityPostDetail(postId: Int)
case getCommunityPostComments(postId: Int, page: Int, size: Int)
case getCommunityCommentReplies(commentId: Int, page: Int, size: Int)
}
extension CreatorChannelCommunityApi: TargetType {
@@ -15,12 +18,21 @@ extension CreatorChannelCommunityApi: TargetType {
switch self {
case .getCommunity(let creatorId, _, _):
return "/api/v2/creator-channels/\(creatorId)/community"
case .getCommunityPostDetail(let postId):
return "/api/v2/creator-channels/community-posts/\(postId)"
case .getCommunityPostComments(let postId, _, _):
return "/api/v2/creator-channels/community-posts/\(postId)/comments"
case .getCommunityCommentReplies(let commentId, _, _):
return "/api/v2/creator-channels/community-comments/\(commentId)/replies"
}
}
var method: Moya.Method {
switch self {
case .getCommunity:
case .getCommunity,
.getCommunityPostDetail,
.getCommunityPostComments,
.getCommunityCommentReplies:
return .get
}
}
@@ -32,6 +44,14 @@ extension CreatorChannelCommunityApi: TargetType {
parameters: ["page": page, "size": size],
encoding: URLEncoding.queryString
)
case .getCommunityPostDetail:
return .requestPlain
case .getCommunityPostComments(_, let page, let size),
.getCommunityCommentReplies(_, let page, let size):
return .requestParameters(
parameters: ["page": page, "size": size],
encoding: URLEncoding.queryString
)
}
}

View File

@@ -10,4 +10,16 @@ final class CreatorChannelCommunityRepository {
func getCommunity(creatorId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCommunity(creatorId: creatorId, page: page, size: size))
}
func getCommunityPostDetail(postId: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCommunityPostDetail(postId: postId))
}
func getCommunityPostComments(postId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCommunityPostComments(postId: postId, page: page, size: size))
}
func getCommunityCommentReplies(commentId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCommunityCommentReplies(commentId: commentId, page: page, size: size))
}
}