File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Projects/Data/Sources/DTO/Notifications Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ import Foundation
2+ import Domain
3+
4+ struct NotificationListResponseDTO : Codable {
5+ let notifications : [ NotificationResponseDTO ]
6+ }
7+
8+ public struct NotificationResponseDTO : Codable {
9+ public let notificationID : Int
10+ public let title , content , topic : String
11+ public let detailID : Int
12+ public let createdAt : String
13+ public let new : Bool
14+
15+ enum CodingKeys : String , CodingKey {
16+ case notificationID = " notification_id "
17+ case title, content, topic
18+ case detailID = " detail_id "
19+ case createdAt = " created_at "
20+ case new
21+ }
22+ }
23+
24+ extension NotificationListResponseDTO {
25+ func toDomain( ) -> [ NotificationEntity ] {
26+ notifications. map {
27+ NotificationEntity (
28+ notificationID: $0. notificationID,
29+ title: $0. title,
30+ content: $0. content,
31+ topic: $0. topic,
32+ detailID: $0. detailID,
33+ createdAt: $0. createdAt. toJobisDate ( ) . toStringFormat ( " yyyy.MM.dd " ) ,
34+ new: $0. new
35+ )
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments