05/02 Phase B

This commit is contained in:
Nguyen Ngo
2026-05-02 11:46:28 -04:00
parent ef0a6448cf
commit 8bdcbecd73
22 changed files with 3262 additions and 69 deletions
+45
View File
@@ -0,0 +1,45 @@
// Models/PendingPhoto.swift
// -------------------------
// SwiftData model for photos waiting to be uploaded to the server.
// Photos are saved locally first, uploaded during sync, then the
// local path reference is replaced with the server path.
import Foundation
import SwiftData
@Model
final class PendingPhoto {
@Attribute(.unique) var localId: String
/// Absolute path in app's Documents/JQC/Photos/ directory
var localFilePath: String
/// "inspection" | "issue"
var entityType: String
/// References LocalInspection.localId or LocalIssue.localId
var entityLocalId: String
/// For inspection form image fields the field's id string
var fieldId: String?
/// Populated after successful upload
var serverPath: String?
/// "pending" | "uploaded" | "failed"
var uploadStatus: String
var createdAt: Date
var inspection: LocalInspection?
init(
localFilePath: String,
entityType: String,
entityLocalId: String,
fieldId: String? = nil
) {
self.localId = UUID().uuidString
self.localFilePath = localFilePath
self.entityType = entityType
self.entityLocalId = entityLocalId
self.fieldId = fieldId
self.serverPath = nil
self.uploadStatus = "pending"
self.createdAt = Date()
}
}