Created and updated dates for waypoints

This commit is contained in:
Garth Vander Houwen 2023-02-05 18:56:14 -08:00
parent 8970464fec
commit 1cd9c8d350
2 changed files with 5 additions and 0 deletions

View file

@ -807,6 +807,8 @@ func waypointPacket (packet: MeshPacket, context: NSManagedObjectContext) {
if waypointMessage.expire > 0 {
waypoint.expire = Date(timeIntervalSince1970: TimeInterval(Int64(waypointMessage.expire)))
}
waypoint.created = Date()
waypoint.lastUpdated = Date()
do {
try context.save()
print("💾 Updated Node Waypoint App Packet For: \(waypoint.id)")
@ -826,6 +828,7 @@ func waypointPacket (packet: MeshPacket, context: NSManagedObjectContext) {
if waypointMessage.expire > 0 {
fetchedWaypoint[0].expire = Date(timeIntervalSince1970: TimeInterval(Int64(waypointMessage.expire)))
}
fetchedWaypoint[0].lastUpdated = Date()
do {
try context.save()
print("💾 Updated Node Waypoint App Packet For: \(fetchedWaypoint[0].id)")

View file

@ -282,9 +282,11 @@
</fetchedProperty>
</entity>
<entity name="WaypointEntity" representedClassName="WaypointEntity" syncable="YES" codeGenerationType="class">
<attribute name="created" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="expire" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="icon" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="id" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="lastUpdated" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="latitudeI" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="locked" attributeType="Integer 64" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="longDescription" optional="YES" attributeType="String" maxValueString="100"/>