06/22 Fix Medium impact items

This commit is contained in:
Nguyen Ngo
2026-06-22 11:40:05 -04:00
parent e68a702bf9
commit 93ee02ea18
6 changed files with 297 additions and 7 deletions
+10 -1
View File
@@ -115,13 +115,22 @@ actor APIClient {
func fetchInspectionHistory(
limit: Int = 50,
offset: Int = 0,
facilityId: Int? = nil
facilityId: Int? = nil,
fromDate: Date? = nil,
toDate: Date? = nil
) async throws -> InspectionHistoryResponseData {
var ep = "/api/v1/inspections?limit=\(limit)&offset=\(offset)&status=completed"
if let fid = facilityId { ep += "&facility_id=\(fid)" }
if let d = fromDate { ep += "&from_date=\(Self.apiDateFmt.string(from: d))" }
if let d = toDate { ep += "&to_date=\(Self.apiDateFmt.string(from: d))" }
return try await request(ep)
}
private static let apiDateFmt: DateFormatter = {
let f = DateFormatter(); f.dateFormat = "yyyy-MM-dd"; f.locale = Locale(identifier: "en_US_POSIX")
return f
}()
// Photo Upload
func uploadPhoto(localPath: String, entityType: String, retrying: Bool = false) async throws -> String {