Files
luma/Sources/LumaCore/Persistence/AddressNoteOutboxRecord.swift
Ole André Vadla Ravnås 1c4177a83d core: Sync address notes via collaboration
AddressNoteOp covers note upsert/remove plus message append/edit.
Outbox table mirrors mission_outbox; inbound ops apply through
Engine and refresh the address-annotation gutter.
2026-05-18 00:25:58 +02:00

28 lines
759 B
Swift

import Foundation
import GRDB
struct AddressNoteOutboxRecord: Codable, Sendable, FetchableRecord, PersistableRecord {
static let databaseTableName = "address_note_outbox"
var opID: String
var kind: String
var noteID: String
var payloadJSON: String
var createdAt: Date
enum CodingKeys: String, CodingKey {
case opID = "op_id"
case kind
case noteID = "note_id"
case payloadJSON = "payload_json"
case createdAt = "created_at"
}
func toOp() -> AddressNoteOp? {
guard let data = payloadJSON.data(using: .utf8),
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
else { return nil }
return AddressNoteOp.fromJSON(obj)
}
}