Hutch/Models/Paste.swift

b2f3bce0c254e11c4a7e871c3bb844a09c53a96e
hutch/Hutch/Models/Paste.swift history · blame · raw

29 lines · 664 bytes

 1import Foundation
 2
 3struct PasteFile: Codable, Sendable, Hashable, Identifiable {
 4    let filename: String?
 5    let hash: String
 6    let contents: URL?
 7
 8    var id: String { hash }
 9}
10
11struct Paste: Codable, Sendable, Identifiable, Hashable {
12    let id: String
13    let created: Date
14    let visibility: Visibility
15    let files: [PasteFile]
16    let user: Entity
17}
18
19struct PasteUploadDraft: Identifiable, Equatable, Sendable {
20    let id: UUID
21    var filename: String
22    var contents: String
23
24    init(id: UUID = UUID(), filename: String = "", contents: String = "") {
25        self.id = id
26        self.filename = filename
27        self.contents = contents
28    }
29}