Implement snapshot version history

This commit is contained in:
Codex
2026-09-13 14:28:43 +02:00
parent e28d45ae18
commit 8bdebc5c24
3 changed files with 50 additions and 1 deletions
@@ -324,6 +324,25 @@ public extension SongProject {
vocalists[index].assignedSections.removeAll { $0 == sectionID }
}
mutating func createVersion(
id: String = UUID().uuidString,
label: String,
createdAt: Date = Date()
) -> SongVersion {
let version = SongVersion(
id: id,
label: label,
snapshot: SongProjectSnapshot(project: self),
createdAt: createdAt
)
versions.append(version)
return version
}
func version(id versionID: String) -> SongVersion? {
versions.first { $0.id == versionID }
}
mutating func appendSection(_ section: SongSection) {
var orderedSection = section
orderedSection.order = nextSectionOrder