Rework storage structs, link preview

This commit is contained in:
Christoph Hagen
2025-01-08 14:59:04 +01:00
parent b99c064d10
commit a7197b9628
75 changed files with 1365 additions and 1454 deletions

View File

@@ -1,33 +1,11 @@
struct ItemId {
let language: ContentLanguage
let type: ItemType
let itemType: ItemType
let id: String?
}
extension ItemId: Equatable {
static func == (lhs: ItemId, rhs: ItemId) -> Bool {
lhs.language == rhs.language &&
lhs.itemType == rhs.itemType
}
}
extension ItemId: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(language)
hasher.combine(itemType.id)
}
}
extension ItemId: Comparable {
extension ItemId: Codable {
static func < (lhs: ItemId, rhs: ItemId) -> Bool {
guard lhs.itemType == rhs.itemType else {
return lhs.itemType < rhs.itemType
}
return lhs.language < rhs.language
}
}