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

@ -20,6 +20,6 @@ extension FileResource {
}
static var mock: FileResource {
Content.mock.files.first(where: { $0.id == "my-file.txt" })!
Content.mock.files.first(where: { $0.identifier == "my-file.txt" })!
}
}

View File

@ -28,13 +28,13 @@ extension Page {
lastModified: nil,
originalUrl: "projects/electronics/my-first-project/en.html"),
tags: [
content.tags.first(where: { $0.id == "electronics" })!
content.tags.first(where: { $0.identifier == "electronics" })!
])
]
}
static var empty: Page {
Content.mock.pages.first(where: { $0.id == "my-id" })!
Content.mock.pages.first(where: { $0.identifier == "my-id" })!
}
}
}

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" })!
}
}
}

View File

@ -13,7 +13,7 @@ extension Tag {
urlComponent: "elektronik",
name: "Elektronik",
linkPreview: .init(description: "Eine Beschreibung des Tags",
image: content.files.first(where: { $0.id == "image2" })!),
image: content.files.first(where: { $0.identifier == "image2" })!),
originalUrl: "projects/electronics"
),
english: .init(
@ -22,7 +22,7 @@ extension Tag {
name: "Electronics",
linkPreview: .init(
description: "Some description of the tag",
image: content.files.first(where: { $0.id == "image1" })!),
image: content.files.first(where: { $0.identifier == "image1" })!),
originalUrl: "projects/electronics")
),
Tag(
@ -53,23 +53,23 @@ extension Tag {
}
static var electronics: Tag {
Content.mock.tags.first(where: { $0.id == "electronics" })!
Content.mock.tags.first(where: { $0.identifier == "electronics" })!
}
static var nature: Tag {
Content.mock.tags.first(where: { $0.id == "nature" })!
Content.mock.tags.first(where: { $0.identifier == "nature" })!
}
static var sports: Tag {
Content.mock.tags.first(where: { $0.id == "sports" })!
Content.mock.tags.first(where: { $0.identifier == "sports" })!
}
static var hiking: Tag {
Content.mock.tags.first(where: { $0.id == "hiking" })!
Content.mock.tags.first(where: { $0.identifier == "hiking" })!
}
static var mountains: Tag {
Content.mock.tags.first(where: { $0.id == "mountains" })!
Content.mock.tags.first(where: { $0.identifier == "mountains" })!
}
}
}