05/11 Update issue's status, and inspector can changes issue's status

This commit is contained in:
Nguyen Ngo
2026-05-11 16:49:22 -04:00
parent c0b47ec132
commit 6367dac1e6
5 changed files with 238 additions and 27 deletions
+44 -1
View File
@@ -271,7 +271,7 @@ struct TemplateDetailResponseData: Decodable, Sendable {
// Inspections
struct APIInspectionSummary: Decodable, Identifiable, Sendable {
struct APIInspectionSummary: Decodable, Identifiable, Hashable, Sendable {
let id: Int
let templateId: Int
let templateName: String
@@ -335,3 +335,46 @@ struct InspectionHistoryResponseData: Decodable, Sendable {
}
private enum CodingKeys: String, CodingKey { case inspections, total, limit, offset }
}
// Issue Detail
struct APIIssueDetail: Decodable, Sendable {
let id: Int
let status: String
let severity: String
let description: String
let assignedTo: Int?
let facilityId: Int?
let facilityName: String?
let reportedAt: String?
let resolvedAt: String?
nonisolated init(from decoder: any Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
id = try c.decode(Int.self, forKey: .id)
status = try c.decode(String.self, forKey: .status)
severity = try c.decode(String.self, forKey: .severity)
description = try c.decode(String.self, forKey: .description)
assignedTo = try? c.decode(Int.self, forKey: .assignedTo)
facilityId = try? c.decode(Int.self, forKey: .facilityId)
facilityName = try? c.decode(String.self, forKey: .facilityName)
reportedAt = try? c.decode(String.self, forKey: .reportedAt)
resolvedAt = try? c.decode(String.self, forKey: .resolvedAt)
}
private enum CodingKeys: String, CodingKey {
case id, status, severity, description, assignedTo
case facilityId, facilityName, reportedAt, resolvedAt
}
}
struct APIIssueStatusUpdate: Decodable, Sendable {
let issueId: Int
let status: String
nonisolated init(from decoder: any Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
issueId = try c.decode(Int.self, forKey: .issueId)
status = try c.decode(String.self, forKey: .status)
}
private enum CodingKeys: String, CodingKey { case issueId, status }
}