Fix id of Items, saving

This commit is contained in:
Christoph Hagen
2025-06-11 08:19:44 +02:00
parent 5970ce2e9f
commit 1d0eba9d78
64 changed files with 233 additions and 217 deletions

View File

@ -27,9 +27,9 @@ extension Post {
startDate: .now,
endDate: nil,
tags: [
content.tags.first(where: { $0.id == "nature" })!,
content.tags.first(where: { $0.id == "sports" })!,
content.tags.first(where: { $0.id == "hiking" })!
content.tags.first(where: { $0.identifier == "nature" })!,
content.tags.first(where: { $0.identifier == "sports" })!,
content.tags.first(where: { $0.identifier == "hiking" })!
],
german: .init(
content: content,
@ -47,44 +47,44 @@ extension Post {
createdDate: .now,
startDate: .now.addingTimeInterval(-86400), endDate: .now,
tags: [
content.tags.first(where: { $0.id == "nature" })!,
content.tags.first(where: { $0.id == "sports" })!,
content.tags.first(where: { $0.id == "hiking" })!,
content.tags.first(where: { $0.id == "mountains" })!
content.tags.first(where: { $0.identifier == "nature" })!,
content.tags.first(where: { $0.identifier == "sports" })!,
content.tags.first(where: { $0.identifier == "hiking" })!,
content.tags.first(where: { $0.identifier == "mountains" })!
],
german: LocalizedPost(
content: content,
title: "Eine lange Wanderung",
text: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend.",
images: [
content.files.first(where: { $0.id == "image1" })!,
content.files.first(where: { $0.id == "image2" })!,
content.files.first(where: { $0.id == "image3" })!,
content.files.first(where: { $0.id == "image4" })!
content.files.first(where: { $0.identifier == "image1" })!,
content.files.first(where: { $0.identifier == "image2" })!,
content.files.first(where: { $0.identifier == "image3" })!,
content.files.first(where: { $0.identifier == "image4" })!
]),
english: LocalizedPost(
content: content,
title: "A longer hike",
text: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
images: [
content.files.first(where: { $0.id == "image1" })!,
content.files.first(where: { $0.id == "image2" })!,
content.files.first(where: { $0.id == "image3" })!,
content.files.first(where: { $0.id == "image4" })!
content.files.first(where: { $0.identifier == "image1" })!,
content.files.first(where: { $0.identifier == "image2" })!,
content.files.first(where: { $0.identifier == "image3" })!,
content.files.first(where: { $0.identifier == "image4" })!
]))
]
}
static var empty: Post {
Content.mock.posts.first(where: { $0.id == "empty" })!
Content.mock.posts.first(where: { $0.identifier == "empty" })!
}
static var hike: Post {
Content.mock.posts.first(where: { $0.id == "hike" })!
Content.mock.posts.first(where: { $0.identifier == "hike" })!
}
static var hike2: Post {
Content.mock.posts.first(where: { $0.id == "hike2" })!
Content.mock.posts.first(where: { $0.identifier == "hike2" })!
}
}
}