-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#456 댓글/답글 관련 API 연동 #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "feat/#456-\uB313\uAE00-api-\uC5F0\uB3D9"
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
189b8e6
feat: #456 댓글 달기 API 연동
y-eonee 06a9cfd
chore: #456 의존성 주입
y-eonee 02d4957
chore: #456 의존성 주입
y-eonee 850fc1a
fix: #456 댓글 작성 완료 시 댓글 텍스트필드 초기화되도록 함
y-eonee ce8ae3d
feat: #456 답글 관련 DTO, Entity 작성
y-eonee ffc5247
feat: #456 CommentAPI 레이어별 구현
y-eonee 334c8df
feat: #456 답글 조회 및 답글 달기 API 연동
y-eonee 0ac7291
feat: #456 답글 카운트 업데이트 함수 구현
y-eonee 651facd
fix: #456 바텀시트가 닫히는 것을 콜백으로 받아 history에서 답글 업데이트
y-eonee b1216ae
feat: #456 특정 코멘트 아이디 비교하여 엔티티 리턴
y-eonee 41fb69f
chore: #456 라이브러리 순서 수정
y-eonee 5d7a962
feat: #456 신고 v2 API 연동
y-eonee 3408e71
chore: #456 의존성 주입
y-eonee ce11c87
feat: #456 댓글, 답글 삭제 API 연동
y-eonee dd22210
fix: #456 댓글 작성 완료 후 플레스홀더가 다시 생기도록 수정
y-eonee a730bdc
feat: #456 댓글, 답글 사용자 차단 API 연동
y-eonee 210371b
feat: #456 댓글 수정 시 uitextview 분기처리
y-eonee 1204480
feat: #456 댓글 수정, 삭제 관련 API Data Layer
y-eonee 53ddb8c
feat: #456 댓글 수정, 삭제 관련 Domain Layer
y-eonee 12f491c
refactor: #456 이름 변경
y-eonee 0e6aa4e
refactor: #456 바텀시트 action 추가
y-eonee a2172f0
feat: #456 댓글 수정 API 연동
y-eonee c0916d8
feat: #456 답글 수정 API 연동
y-eonee c68ecad
chore: #456 의존성 주입
y-eonee a867353
fix: #456 develop 충돌 해결
y-eonee 8aaedf3
fix: #456 공감 안눌리는 오류 수정
y-eonee f8d2819
feat: #456 바인딩 함수 추가
y-eonee 153b251
refactor: #456 presentation -> domain layer로 변경
y-eonee 4bf8742
refactor: #456 파라미터 네이밍 통일
y-eonee cffd534
refactor: #456 타겟아이디가 0으로 가지 않도록 가드 처리
y-eonee 1773bc8
refactor: #456 configure 함수 통합
y-eonee d3a2a8d
refactor: #456 viewModel에서 값을 들고 올 수 있도록 수정
y-eonee 78d01ab
refactor: #456 targetType switch case로 분리
y-eonee 36f388d
refactor: #456 bind 함수 분리
y-eonee 37c3130
refactor: #456 카멜케이스로 변경
y-eonee a1224ac
chore: #456 충돌 해결 후 코드 정리
y-eonee e42cb39
setting: #456 macos 버전 수정
y-eonee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ on: | |
|
|
||
| jobs: | ||
| build: | ||
| runs-on: macos-latest | ||
| runs-on: macos-15 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ByeBoo-iOS/ByeBoo-iOS/Data/Model/CommonQuestCommentRequestDTO.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // CommonQuestCommentRequestDTO.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/14/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct CommonQuestCommentRequestDTO: Encodable { | ||
| let content: String | ||
| let targetId: Int | ||
| } |
12 changes: 12 additions & 0 deletions
12
ByeBoo-iOS/ByeBoo-iOS/Data/Model/CommonQuestReplyRequestDTO.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // | ||
| // CommonQuestReplyRequestDTO.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/14/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct CommonQuestReplyRequestDTO: Encodable { | ||
| let content: String | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // ReportRequestDTO.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/16/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct ReportRequestDTO: Encodable { | ||
| let targetType: String | ||
| let targetId: Int | ||
| } |
81 changes: 81 additions & 0 deletions
81
ByeBoo-iOS/ByeBoo-iOS/Data/Network/EndPoint/CommentAPI.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // | ||
| // CommentAPI.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/14/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Alamofire | ||
|
|
||
| enum CommentAPI { | ||
| case postComment(dto: CommonQuestCommentRequestDTO) | ||
| case postReply(commentID: Int, dto: CommonQuestReplyRequestDTO) | ||
| case fetchReplies(commentID: Int) | ||
| case patchComment(commentID: Int, dto: CommonQuestReplyRequestDTO) | ||
| case deleteComment(commentID: Int) | ||
| } | ||
|
|
||
| extension CommentAPI: EndPoint { | ||
| var basePath: String { | ||
| return "/api/v1/comments" | ||
| } | ||
|
|
||
| var path: String { | ||
| switch self { | ||
| case .postComment: | ||
| return "" | ||
| case .patchComment(let commentID, _), .deleteComment(let commentID): | ||
| return "/\(commentID)" | ||
| case .postReply(let commentID, _), .fetchReplies(let commentID): | ||
| return "/\(commentID)/replies" | ||
| } | ||
| } | ||
|
|
||
| var method: Alamofire.HTTPMethod { | ||
| switch self { | ||
| case .postComment, .postReply: | ||
| return .post | ||
| case .fetchReplies: | ||
| return .get | ||
| case .patchComment: | ||
| return .patch | ||
| case .deleteComment: | ||
| return .delete | ||
| } | ||
| } | ||
|
|
||
| var headers: HeaderType { | ||
| switch self { | ||
| case .postComment, .postReply, .fetchReplies, .patchComment, .deleteComment: | ||
| return .withAuth | ||
| } | ||
| } | ||
|
|
||
| var parameterEncoding: any Alamofire.ParameterEncoding { | ||
| switch self { | ||
| case .postComment, .postReply, .patchComment: | ||
| return JSONEncoding.default | ||
| case .fetchReplies, .deleteComment: | ||
| return URLEncoding.default | ||
| } | ||
| } | ||
|
|
||
| var queryParameters: [String : String]? { | ||
| nil | ||
| } | ||
|
|
||
| var bodyParameters: Alamofire.Parameters? { | ||
| switch self { | ||
| case .postComment(let dto): | ||
| return try? dto.toDictionary() | ||
| case .postReply(_, let dto): | ||
| return try? dto.toDictionary() | ||
| case .patchComment(_, let dto): | ||
| return try? dto.toDictionary() | ||
| case .fetchReplies, .deleteComment: | ||
| return nil | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
ByeBoo-iOS/ByeBoo-iOS/Data/Repository/CommentRepository.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // | ||
| // CommentRepository.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/14/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct DefaultCommentRepository: CommentInterface { | ||
|
|
||
| private let network: NetworkService | ||
| private let userDefaultServcie: UserDefaultService | ||
|
|
||
| init( | ||
| network: NetworkService, | ||
| userDefaultService: UserDefaultService | ||
| ) { | ||
| self.network = network | ||
| self.userDefaultServcie = userDefaultService | ||
| } | ||
|
|
||
| func postComment(content: String, answerID: Int) async throws { | ||
| let postCommentRequestDTO: CommonQuestCommentRequestDTO = .init(content: content, targetId: answerID) | ||
| let _ = try await network.request(CommentAPI.postComment(dto: postCommentRequestDTO)) | ||
| } | ||
|
|
||
| func postReply(content: String, commentID: Int) async throws { | ||
| let postReplyRequestDTO: CommonQuestReplyRequestDTO = .init(content: content) | ||
| let _ = try await network.request(CommentAPI.postReply(commentID: commentID, dto: postReplyRequestDTO)) | ||
| } | ||
|
|
||
| func fetchReplies(commentID: Int) async throws -> CommonQuestReplyListEntity { | ||
| let userID: Int = userDefaultServcie.load(key: .userID) ?? 0 | ||
| let result = try await network.request( | ||
| CommentAPI.fetchReplies(commentID: commentID), | ||
| decodingType: CommonQuestAnswerRepliesResponseDTO.self | ||
| ) | ||
| return result.toEntity(userID: userID) | ||
| } | ||
|
|
||
| func patchComment(content: String, commentID: Int) async throws { | ||
| let patchCommentRequestDTO: CommonQuestReplyRequestDTO = .init(content: content) | ||
| let _ = try await network.request(CommentAPI.patchComment(commentID: commentID, dto: patchCommentRequestDTO)) | ||
| } | ||
|
|
||
| func deleteComment(commentID: Int) async throws { | ||
| let _ = try await network.request(CommentAPI.deleteComment(commentID: commentID)) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ByeBoo-iOS/ByeBoo-iOS/Domain/Entity/CommonQuestReplyListEntity.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // CommonQuestReplyListEntity.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/15/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct CommonQuestReplyListEntity { | ||
| let totalCount: Int | ||
| let replies: [CommonQuestCommentEntity] | ||
| } |
13 changes: 13 additions & 0 deletions
13
ByeBoo-iOS/ByeBoo-iOS/Domain/Entity/Enum/CommonQuestTargetType.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // CommonQuestTargetType.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/16/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| enum CommonQuestTargetType: String { | ||
| case comment = "COMMENT" | ||
| case commonQuest = "COMMON_QUEST" | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
16 changes: 16 additions & 0 deletions
16
ByeBoo-iOS/ByeBoo-iOS/Domain/Interface/CommentInterface.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // | ||
| // CommentInterface.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 6/14/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| protocol CommentInterface { | ||
| func postComment(content: String, answerID: Int) async throws | ||
| func postReply(content: String, commentID: Int) async throws | ||
| func fetchReplies(commentID: Int) async throws -> CommonQuestReplyListEntity | ||
| func patchComment(content: String, commentID: Int) async throws | ||
| func deleteComment(commentID: Int) async throws | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
신고 요청 바디 직렬화 실패를 삼키지 마세요.
Line 53에서
try?를 사용하면 인코딩 실패 시nilbody로 요청이 전송되어, 실제 원인이 가려진 채 기능 실패가 발생할 수 있습니다. 실패를 명시적으로 로깅/전파하도록 처리하는 게 안전합니다.제안 수정안
var bodyParameters: Alamofire.Parameters? { switch self { case .postReport(let dto): - return try? dto.toDictionary() + do { + return try dto.toDictionary() + } catch { + ByeBooLogger.error(error) + return nil + } } }🤖 Prompt for AI Agents