-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] #510 - DTO-Entity 분리 및 최신 컨벤션 반영 #511
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
Open
hyowon612
wants to merge
7
commits into
Develop
Choose a base branch
from
Refactor/#510
base: Develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f57c982
[Refactor] #510 - SearchKeyword DTO/Entity 분리
hyowon612 872ae20
[Refactor] #510 - NovelReview DTO/Entity 분리
hyowon612 d89bd96
[Refactor] #510 - Auth DTO/Entity 분리
hyowon612 a302303
[Refactor] #510 - NovelReview DTO/Entity 분리
hyowon612 829f1bf
[Refactor] #510 - Auth DTO/Entity 분리
hyowon612 78de1e1
[Refactor] #510 - VM 거칠 필요 없는 로직 VC엑서 처리
hyowon612 3242018
[Fix] #510 - 구리스 코리 반영
hyowon612 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
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
4 changes: 2 additions & 2 deletions
4
...S/WSSiOS/Source/Data/DTO/AuthResult.swift → WSSiOS/WSSiOS/Source/Data/DTO/Auth.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
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
4 changes: 2 additions & 2 deletions
4
...Source/Data/DTO/SearchKeywordResult.swift → ...urce/Data/DTO/SearchKeywordResponse.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
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,36 @@ | ||
| // | ||
| // AuthEntity.swift | ||
| // WSSiOS | ||
| // | ||
| // Created by Hyowon Jeon on 3/23/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct AppleLoginEntity { | ||
| let authorizationCode: Data | ||
| let idToken: Data | ||
| } | ||
|
|
||
| extension AppleLoginEntity { | ||
| func toDTO() -> AppleLoginRequest { | ||
| let authorizationCode = String(data: authorizationCode, encoding: String.Encoding.utf8)! | ||
| let idToken = String(data: idToken, encoding: String.Encoding.utf8)! | ||
| return AppleLoginRequest(authorizationCode: authorizationCode, | ||
| idToken: idToken) | ||
| } | ||
| } | ||
|
|
||
| struct LoginEntity { | ||
| let Authorization: String | ||
| let refreshToken: String | ||
| let isRegister: Bool | ||
| } | ||
|
|
||
| extension LoginResponse { | ||
| func toEntity() -> LoginEntity { | ||
| return LoginEntity(Authorization: self.Authorization, | ||
| refreshToken: self.refreshToken, | ||
| isRegister: self.isRegister) | ||
| } | ||
| } |
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,86 @@ | ||
| // | ||
| // NovelReviewEntity.swift | ||
| // WSSiOS | ||
| // | ||
| // Created by Hyowon Jeon on 3/23/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct NovelReviewEntity { | ||
| let novelTitle: String | ||
| let status: ReadStatus? | ||
| let startDate: Date? | ||
| let endDate: Date? | ||
| let userNovelRating: Float | ||
| let attractivePoints: [AttractivePoint?] | ||
| let keywords: [KeywordData] | ||
| } | ||
|
|
||
| extension NovelReviewResponse { | ||
| func toEntity() -> NovelReviewEntity { | ||
| let dateFormatter = DateFormatter().then { | ||
| $0.dateFormat = "yyyy-MM-dd" | ||
| $0.timeZone = TimeZone(identifier: "ko_KR") | ||
| } | ||
|
|
||
| let startDate = self.startDate.flatMap { dateFormatter.date(from: $0) } | ||
| let endDate = self.endDate.flatMap { dateFormatter.date(from: $0) } | ||
| let readStatus = self.status.flatMap { ReadStatus(rawValue: $0) } | ||
| let attractivePoints = self.attractivePoints.map { AttractivePoint(rawValue: $0) } | ||
|
|
||
| return NovelReviewEntity(novelTitle: self.novelTitle, | ||
| status: readStatus, | ||
| startDate: startDate, | ||
| endDate: endDate, | ||
| userNovelRating: self.userNovelRating, | ||
| attractivePoints: attractivePoints, | ||
| keywords: self.keywords) | ||
| } | ||
| } | ||
|
|
||
| struct PostNovelReviewEntity { | ||
| let novelId: Int | ||
| let userNovelRating: Float | ||
| let status: ReadStatus | ||
| let startDate: String? | ||
| let endDate: String? | ||
| let attractivePoints: [AttractivePoint?] | ||
| let keywordIds: [Int] | ||
| } | ||
|
|
||
| extension PostNovelReviewEntity { | ||
| func toDTO() -> PostNovelReviewRequest { | ||
| let statusString = self.status.rawValue | ||
| let attractivePoints = self.attractivePoints.compactMap { $0?.rawValue } | ||
| return PostNovelReviewRequest(novelId: self.novelId, | ||
| userNovelRating: self.userNovelRating, | ||
| status: statusString, | ||
| startDate: self.startDate, | ||
| endDate: self.endDate, | ||
| attractivePoints: attractivePoints, | ||
| keywordIds: self.keywordIds) | ||
| } | ||
| } | ||
|
|
||
| struct PutNovelReviewEntity { | ||
| let userNovelRating: Float | ||
| let status: ReadStatus | ||
| let startDate: String? | ||
| let endDate: String? | ||
| let attractivePoints: [AttractivePoint?] | ||
| let keywordIds: [Int] | ||
| } | ||
|
|
||
| extension PutNovelReviewEntity { | ||
| func toDTO() -> PutNovelReviewRequest { | ||
| let statusString = self.status.rawValue | ||
| let attractivePoints = self.attractivePoints.compactMap { $0?.rawValue } | ||
| return PutNovelReviewRequest(userNovelRating: self.userNovelRating, | ||
| status: statusString, | ||
| startDate: self.startDate, | ||
| endDate: self.endDate, | ||
| attractivePoints: attractivePoints, | ||
| keywordIds: self.keywordIds) | ||
| } | ||
| } | ||
18 changes: 18 additions & 0 deletions
18
WSSiOS/WSSiOS/Source/Data/Entity/SearchKeywordEntity.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,18 @@ | ||
| // | ||
| // SearchKeywordEntity.swift | ||
| // WSSiOS | ||
| // | ||
| // Created by Hyowon Jeon on 3/23/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| struct SearchKeywordEntity { | ||
| let categories: [KeywordCategory] | ||
| } | ||
|
|
||
| extension SearchKeywordResponse { | ||
| func toEntity() -> SearchKeywordEntity { | ||
| return SearchKeywordEntity(categories: self.categories) | ||
| } | ||
| } |
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
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.
해당 변수를
DateFormatter익스텐션으로 빼서static변수로 만드는 게 기능상 좋아보입니다!DateFormatter는 내부적인 계산이 많이 들어가는 값이기 떄문에 static 변수로 빼서 한번만 생성되고 앱 내에서 재사용 되는 방법이 어떨까요?