-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from YAPP-Github/TNT-195-traineeHomeAPI
[TNT-195] ํธ๋ ์ด๋ ํ, ์๋จ ํ์ธ ํ๋ฉด API ์ฐ๊ฒฐ
- Loading branch information
Showing
17 changed files
with
391 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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,59 @@ | ||
// | ||
// TraineeMapper.swift | ||
// Domain | ||
// | ||
// Created by ๋ฐ๋ฏผ์ on 2/14/25. | ||
// Copyright ยฉ 2025 yapp25thTeamTnT. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public extension PTInfoResDTO { | ||
func toEntity() -> WorkoutListItemEntity? { | ||
guard !self.isEmpty else { return nil } | ||
return .init( | ||
id: Int.random(in: 1...10000), | ||
currentCount: self.session ?? 0, | ||
startDate: self.lessonStart?.toDate(format: .ISO8601), | ||
endDate: self.lessonEnd?.toDate(format: .ISO8601), | ||
trainerProfileImageUrl: self.trainerProfileImage, | ||
trainerName: self.trainerName ?? "", | ||
hasRecord: false | ||
) | ||
} | ||
} | ||
|
||
public extension DietResDTO { | ||
func toEntity() -> RecordListItemEntity { | ||
return .init( | ||
id: self.dietId, | ||
type: self.dietType.toEntity(), | ||
date: self.date.toDate(format: .ISO8601), | ||
title: self.memo, | ||
hasFeedBack: false, | ||
imageUrl: self.dietImageUrl | ||
) | ||
} | ||
} | ||
|
||
public extension DietTypeResDTO { | ||
func toEntity() -> RecordType? { | ||
let dietType: DietType? = { | ||
switch self { | ||
case .breakfast: | ||
return .breakfast | ||
case .lunch: | ||
return .lunch | ||
case .dinner: | ||
return .dinner | ||
case .snack: | ||
return .snack | ||
case .unknown: | ||
return nil | ||
} | ||
}() | ||
|
||
guard let dietType else { return nil } | ||
return .diet(type: dietType) | ||
} | ||
} |
This file contains 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 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 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.