Generate first tag pages
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user