@@ -11,12 +11,14 @@ public struct Station: Codable, Sendable {
1111 public let name : String
1212 public let curatorName : String
1313 public let imageUrl : URL ?
14+ public let description : String
15+ public let active : Bool ?
1416 public let createdAt : Date
1517 public let updatedAt : Date
1618
1719 // Custom coding keys to handle the imageUrl conversion
1820 private enum CodingKeys : String , CodingKey {
19- case id, name, curatorName, createdAt, updatedAt
21+ case id, name, curatorName, description , active , createdAt, updatedAt
2022 case imageUrlString = " imageUrl "
2123 }
2224
@@ -26,6 +28,8 @@ public struct Station: Codable, Sendable {
2628 id = try container. decode ( String . self, forKey: . id)
2729 name = try container. decode ( String . self, forKey: . name)
2830 curatorName = try container. decode ( String . self, forKey: . curatorName)
31+ description = try container. decode ( String . self, forKey: . description)
32+ active = try container. decodeIfPresent ( Bool . self, forKey: . active)
2933 createdAt = try container. decode ( Date . self, forKey: . createdAt)
3034 updatedAt = try container. decode ( Date . self, forKey: . updatedAt)
3135
@@ -43,6 +47,8 @@ public struct Station: Codable, Sendable {
4347 try container. encode ( id, forKey: . id)
4448 try container. encode ( name, forKey: . name)
4549 try container. encode ( curatorName, forKey: . curatorName)
50+ try container. encode ( description, forKey: . description)
51+ try container. encodeIfPresent ( active, forKey: . active)
4652 try container. encode ( createdAt, forKey: . createdAt)
4753 try container. encode ( updatedAt, forKey: . updatedAt)
4854
@@ -52,25 +58,30 @@ public struct Station: Codable, Sendable {
5258
5359 // Original initializer updated to convert String to URL
5460 public init (
55- id: String , name: String , curatorName: String , imageUrl: String ? , createdAt : Date ,
56- updatedAt: Date
61+ id: String , name: String , curatorName: String , imageUrl: String ? , description : String ,
62+ active : Bool ? = nil , createdAt : Date , updatedAt: Date
5763 ) {
5864 self . id = id
5965 self . name = name
6066 self . curatorName = curatorName
6167 self . imageUrl = imageUrl != nil ? URL ( string: imageUrl!) : nil
68+ self . description = description
69+ self . active = active
6270 self . createdAt = createdAt
6371 self . updatedAt = updatedAt
6472 }
6573
6674 // New convenience initializer that accepts URL directly
6775 public init (
68- id: String , name: String , curatorName: String , imageUrl: URL ? , createdAt: Date , updatedAt: Date
76+ id: String , name: String , curatorName: String , imageUrl: URL ? , description: String ,
77+ active: Bool ? = nil , createdAt: Date , updatedAt: Date
6978 ) {
7079 self . id = id
7180 self . name = name
7281 self . curatorName = curatorName
7382 self . imageUrl = imageUrl
83+ self . description = description
84+ self . active = active
7485 self . createdAt = createdAt
7586 self . updatedAt = updatedAt
7687 }
0 commit comments