Generate first tag pages

This commit is contained in:
Christoph Hagen
2024-12-09 17:47:03 +01:00
parent 4f08526978
commit 8183bc4903
35 changed files with 719 additions and 1105 deletions

View File

@ -2,6 +2,8 @@ import Foundation
final class Post: ObservableObject {
unowned let content: Content
@Published
var id: String
@ -33,7 +35,8 @@ final class Post: ObservableObject {
@Published
var linkedPage: Page?
init(id: String,
init(content: Content,
id: String,
isDraft: Bool,
createdDate: Date,
startDate: Date,
@ -42,6 +45,7 @@ final class Post: ObservableObject {
german: LocalizedPost,
english: LocalizedPost,
linkedPage: Page? = nil) {
self.content = content
self.id = id
self.isDraft = isDraft
self.createdDate = createdDate
@ -60,6 +64,17 @@ final class Post: ObservableObject {
case .german: return german
}
}
func update(id newId: String) -> Bool {
do {
try content.storage.move(post: id, to: newId)
} catch {
print("Failed to move file of post \(id)")
return false
}
id = newId
return true
}
}
extension Post: Identifiable {