You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
652 B
28 lines
652 B
import Foundation
|
|
import GRDB
|
|
|
|
nonisolated struct Playlist: Codable, Identifiable, Equatable, Hashable, Sendable {
|
|
var id: Int64?
|
|
var name: String
|
|
var createdAt: Date
|
|
}
|
|
|
|
nonisolated extension Playlist: FetchableRecord, MutablePersistableRecord {
|
|
static let databaseTableName = "playlists"
|
|
|
|
mutating func didInsert(_ inserted: InsertionSuccess) {
|
|
id = inserted.rowID
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension Playlist {
|
|
static func fixture(
|
|
id: Int64? = nil,
|
|
name: String = "Test Playlist",
|
|
createdAt: Date = Date()
|
|
) -> Playlist {
|
|
Playlist(id: id, name: name, createdAt: createdAt)
|
|
}
|
|
}
|
|
#endif
|
|
|