Skip to content

Commit

Permalink
[Feat] sopt-makers#153- entity에서 model로 변환하는 Transform 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
devxsby committed Apr 15, 2023
1 parent 7d3ad6e commit b4f8e49
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
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)
}
}
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)
}
}

This file was deleted.

0 comments on commit b4f8e49

Please sign in to comment.