05/05 Update the API to follow-up and resinspection

This commit is contained in:
Nguyen Ngo
2026-05-05 18:19:31 -04:00
parent 9d6b5e5bcb
commit b9e504b72c
8 changed files with 342 additions and 18 deletions
+16
View File
@@ -39,6 +39,18 @@ final class LocalInspection {
var syncErrorMessage: String?
var syncRetryCount: Int
// Follow-up / re-inspection (populated from server after sync)
/// Set by director/admin on the web app; signals this inspection needs a follow-up.
@Attribute var followUpRequired: Bool = false
/// Optional note explaining what the follow-up should address.
var followUpNote: String?
/// Server ID of the parent inspection this record is a re-inspection of.
var parentServerId: Int?
/// Local UUID of the parent LocalInspection set at creation, always available
/// regardless of whether the parent has synced. Used to clear the parent's
/// followUpRequired badge without relying on parentServerId being non-nil.
var parentLocalId: String?
// Relationships
@Relationship(deleteRule: .cascade) var pendingPhotos: [PendingPhoto]
@Relationship(deleteRule: .cascade) var localIssues: [LocalIssue]
@@ -66,6 +78,10 @@ final class LocalInspection {
self.syncStatus = "pending"
self.syncErrorMessage = nil
self.syncRetryCount = 0
self.followUpRequired = false
self.followUpNote = nil
self.parentServerId = nil
self.parentLocalId = nil
self.pendingPhotos = []
self.localIssues = []
}