forked from sopt-makers/SOPT-iOS
-
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.
[Feat] sopt-makers#153- entity에서 model로 변환하는 Transform 추가
- Loading branch information
Showing
3 changed files
with
75 additions
and
19 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
SOPT-iOS/Projects/Data/Sources/Transform/AttendanceScheduleTransform.swift
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,33 @@ | ||
// | ||
// AttendanceScheduleTransform.swift | ||
// Data | ||
// | ||
// Created by devxsby on 2023/04/11. | ||
// Copyright © 2023 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import Domain | ||
import Network | ||
|
||
extension AttendanceScheduleEntity { | ||
|
||
public func toDomain() -> AttendanceScheduleModel { | ||
return .init(type: self.type, | ||
location: self.location, | ||
name: self.name, | ||
startDate: self.startDate, | ||
endDate: self.endDate, | ||
message: self.message, | ||
attendances: self.attendances.map { $0.toDomain() }) | ||
} | ||
} | ||
|
||
extension TodayAttendance { | ||
|
||
public func toDomain() -> TodayAttendanceModel { | ||
return .init(status: self.status, | ||
attendedAt: self.attendedAt) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
SOPT-iOS/Projects/Data/Sources/Transform/AttendanceScoreTransform.swift
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,42 @@ | ||
// | ||
// AttendanceScoreTransform.swift | ||
// Data | ||
// | ||
// Created by devxsby on 2023/04/15. | ||
// Copyright © 2023 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import Domain | ||
import Network | ||
|
||
extension AttendanceScoreEntity { | ||
|
||
public func toDomain() -> AttendanceScoreModel { | ||
.init(part: self.part, | ||
generation: self.generation, | ||
name: self.name, | ||
score: self.score, | ||
total: self.total.toDomain(), | ||
attendances: self.attendances.map { $0.toDomain() } ) | ||
} | ||
} | ||
|
||
extension TotalScore { | ||
public func toDomain() -> TotalScoreModel { | ||
.init(attendance: self.attendance, | ||
absent: self.absent, | ||
tardy: self.tardy, | ||
participate: self.participate) | ||
} | ||
} | ||
|
||
extension Attendance { | ||
public func toDomain() -> AttendanceModel { | ||
.init(attribute: self.attribute, | ||
name: self.name, | ||
status: self.status, | ||
date: self.date) | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
SOPT-iOS/Projects/Data/Sources/Transform/ShowAttendanceTransform.swift
This file was deleted.
Oops, something went wrong.