|
|
|
|
@ -65,7 +65,7 @@ open class SyncedModelObject: BaseModelObject { |
|
|
|
|
enum CodingKeys: String, CodingKey { |
|
|
|
|
case relatedUser |
|
|
|
|
case lastUpdate |
|
|
|
|
case shared = "_shared" |
|
|
|
|
case sharing = "_sharing" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Required initializer for Decodable |
|
|
|
|
@ -73,7 +73,7 @@ open class SyncedModelObject: BaseModelObject { |
|
|
|
|
let container = try decoder.container(keyedBy: CodingKeys.self) |
|
|
|
|
self.relatedUser = try container.decodeIfPresent(String.self, forKey: .relatedUser) |
|
|
|
|
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: .lastUpdate) ?? Date() |
|
|
|
|
self.sharing = try container.decodeIfPresent(SharingStatus.self, forKey: .shared) |
|
|
|
|
self.sharing = try container.decodeIfPresent(SharingStatus.self, forKey: .sharing) |
|
|
|
|
|
|
|
|
|
try super.init(from: decoder) |
|
|
|
|
} |
|
|
|
|
@ -84,7 +84,7 @@ open class SyncedModelObject: BaseModelObject { |
|
|
|
|
try container.encode(relatedUser, forKey: .relatedUser) |
|
|
|
|
try container.encode(lastUpdate, forKey: .lastUpdate) |
|
|
|
|
if self.sharing != nil { |
|
|
|
|
try container.encodeIfPresent(sharing, forKey: .shared) |
|
|
|
|
try container.encodeIfPresent(sharing, forKey: .sharing) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try super.encode(to: encoder) |
|
|
|
|
|