-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] Comment 엔티티 통합 및 네이밍 변경 #269
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
Changes from all commits
64c0ec3
8bad60d
8dcfd0f
96353cf
dd5823e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ import Foundation | |||||||||||||||||
| enum CommentMapper { } | ||||||||||||||||||
|
|
||||||||||||||||||
| extension CommentMapper { | ||||||||||||||||||
| static func toDomain(_ response: [DTO.Response.FetchUserComments]) -> [UserComment] { | ||||||||||||||||||
| static func toDomain(_ response: [DTO.Response.FetchUserComments]) -> [Comment] { | ||||||||||||||||||
| let dateFormatter = DateFormatter() | ||||||||||||||||||
| dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||||||||||||||||||
| dateFormatter.timeZone = TimeZone(abbreviation: "KST") | ||||||||||||||||||
|
|
@@ -29,30 +29,29 @@ extension CommentMapper { | |||||||||||||||||
| postStatus = .normal | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| return UserComment( | ||||||||||||||||||
| comment: CommentInfo( | ||||||||||||||||||
| author: User( | ||||||||||||||||||
| id: comment.memberID, | ||||||||||||||||||
| nickname: comment.memberNickname, | ||||||||||||||||||
| profileURL: url, | ||||||||||||||||||
| fanTeam: fanTeam | ||||||||||||||||||
| ), | ||||||||||||||||||
| id: comment.commentID, | ||||||||||||||||||
| text: comment.commentText, | ||||||||||||||||||
| createdDate: date, | ||||||||||||||||||
| status: postStatus, | ||||||||||||||||||
| like: Like( | ||||||||||||||||||
| status: comment.isLiked, | ||||||||||||||||||
| count: comment.commentLikedNumber | ||||||||||||||||||
| ), | ||||||||||||||||||
| opacity: Opacity(value: comment.memberGhost) | ||||||||||||||||||
| return Comment( | ||||||||||||||||||
| id: comment.commentID, | ||||||||||||||||||
| author: User( | ||||||||||||||||||
| id: comment.memberID, | ||||||||||||||||||
| nickname: comment.memberNickname, | ||||||||||||||||||
| profileURL: url, | ||||||||||||||||||
| fanTeam: fanTeam | ||||||||||||||||||
| ), | ||||||||||||||||||
| contentID: comment.contentID | ||||||||||||||||||
| text: comment.commentText, | ||||||||||||||||||
| contentID: comment.contentID, | ||||||||||||||||||
| isDeleted: false, | ||||||||||||||||||
| createdDate: date, | ||||||||||||||||||
| parentContentID: -1, | ||||||||||||||||||
| children: [], | ||||||||||||||||||
| likeCount: comment.likedCount, | ||||||||||||||||||
| isLiked: comment.isLiked, | ||||||||||||||||||
| opacity: Opacity(value: comment.memberGhost), | ||||||||||||||||||
| status: postStatus | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| static func toDomain(_ response: [DTO.Response.FetchContentComments]) -> [ContentComment] { | ||||||||||||||||||
| static func toDomain(_ contentID: Int, _ response: [DTO.Response.FetchContentComments]) -> [Comment] { | ||||||||||||||||||
| let dateFormatter = DateFormatter() | ||||||||||||||||||
| dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||||||||||||||||||
|
|
||||||||||||||||||
|
Comment on lines
55
to
57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 타임존/로케일 누락으로 시간 불일치(+9h) 및 기기 로케일 의존 위험 두 번째 매핑 함수에서는 timeZone/locale 설정이 없어서 디바이스 기본값을 따릅니다. 첫 번째 함수(KST 지정)와 결과가 달라질 수 있고, Asia/Seoul 기준 서비스라면 최대 +9시간 오차가 발생합니다. 고정 포맷 파싱에서는 en_US_POSIX 로케일 지정도 필수에 가깝습니다. 즉시 아래처럼 보완해 주세요. dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+ dateFormatter.locale = Locale(identifier: "en_US_POSIX")
+ dateFormatter.timeZone = TimeZone(identifier: "Asia/Seoul")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
@@ -70,27 +69,24 @@ extension CommentMapper { | |||||||||||||||||
| postStatus = .normal | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| return ContentComment( | ||||||||||||||||||
| comment: CommentInfo( | ||||||||||||||||||
| author: User( | ||||||||||||||||||
| id: comment.memberID, | ||||||||||||||||||
| nickname: comment.memberNickname, | ||||||||||||||||||
| profileURL: url, | ||||||||||||||||||
| fanTeam: fanTeam | ||||||||||||||||||
| ), | ||||||||||||||||||
| id: comment.commentID, | ||||||||||||||||||
| text: comment.commentText, | ||||||||||||||||||
| createdDate: date, | ||||||||||||||||||
| status: postStatus, | ||||||||||||||||||
| like: Like( | ||||||||||||||||||
| status: comment.isLiked, | ||||||||||||||||||
| count: comment.commentLikedNumber | ||||||||||||||||||
| ), | ||||||||||||||||||
| opacity: Opacity(value: comment.memberGhost) | ||||||||||||||||||
| return Comment( | ||||||||||||||||||
| id: comment.commentID, | ||||||||||||||||||
| author: User( | ||||||||||||||||||
| id: comment.memberID, | ||||||||||||||||||
| nickname: comment.memberNickname, | ||||||||||||||||||
| profileURL: url, | ||||||||||||||||||
| fanTeam: fanTeam | ||||||||||||||||||
| ), | ||||||||||||||||||
| parentID: comment.parentCommentID, | ||||||||||||||||||
| text: comment.commentText, | ||||||||||||||||||
| contentID: contentID, | ||||||||||||||||||
| isDeleted: comment.isDeleted, | ||||||||||||||||||
| childs: comment.childComments.map(toDomain) ?? [] | ||||||||||||||||||
| createdDate: date, | ||||||||||||||||||
| parentContentID: comment.parentCommentID, | ||||||||||||||||||
| children: CommentMapper.toDomain(contentID, comment.childComments ?? []), | ||||||||||||||||||
| likeCount: comment.likedCount, | ||||||||||||||||||
| isLiked: comment.isLiked, | ||||||||||||||||||
| opacity: Opacity(value: comment.memberGhost), | ||||||||||||||||||
| status: postStatus | ||||||||||||||||||
| ) | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
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.
🛠️ Refactor suggestion
고정 포맷 파싱에는 en_US_POSIX와 식별자 기반 타임존(Asia/Seoul) 사용 권장
약어("KST")는 환경별로 인식 실패 가능성이 있고, 고정 포맷에는 en_US_POSIX가 정석입니다. 아래처럼 교체 및 보강을 제안합니다.
📝 Committable suggestion
🤖 Prompt for AI Agents