Made Console and Game name Mandatory. Implemented currently all game details with import&export
This commit is contained in:
@@ -71,13 +71,15 @@ class LibraryImport {
|
||||
private func makeCDGame(from game: BHLGame, _ gameDict: inout [UUID : Game], _ cdConsole: Console) {
|
||||
let cdGame = Game(context: CDManager.shared.viewContext)
|
||||
gameDict[game.uuid] = cdGame
|
||||
cdGame.name = game.name
|
||||
cdGame.name = game.name ?? "n/a"
|
||||
cdGame.uuid = game.uuid
|
||||
cdGame.inWishlist = game.inWishlist
|
||||
cdGame.isFinished = game.isFinished
|
||||
cdGame.finishedDate = game.finishedDate
|
||||
cdGame.lentTo = game.lentTo
|
||||
cdGame.cover_icloud_path = game.cover_icloud_path
|
||||
cdGame.pickupDescription = game.pickupDescription
|
||||
cdGame.isDigital = game.isDigital
|
||||
|
||||
if let date = Date.from(string: game.createdAt) {
|
||||
cdGame.createdAt = date
|
||||
@@ -85,8 +87,6 @@ class LibraryImport {
|
||||
print("Could not decode date '\(game.createdAt)' for game '\(cdGame.name)'")
|
||||
}
|
||||
|
||||
//TODO: cdGame.createdAt = game.createdAt.
|
||||
|
||||
cdConsole.addToGames(cdGame)
|
||||
cdGame.console = cdConsole
|
||||
print("Imported: \(cdGame.name) for \(cdConsole.name)")
|
||||
@@ -108,7 +108,7 @@ class LibraryImport {
|
||||
|
||||
private func makeCDConsole(from console : BHLConsole) -> Console {
|
||||
let cdConsole = Console(context: CDManager.shared.viewContext)
|
||||
cdConsole.name = console.name
|
||||
cdConsole.name = console.name ?? "n/a"
|
||||
cdConsole.uuid = console.uuid
|
||||
cdConsole.manufacturer = console.manufacturer
|
||||
cdConsole.shortName = console.shortName
|
||||
@@ -190,11 +190,12 @@ struct BHLibrary : Decodable {
|
||||
|
||||
struct BHLGame : Decodable {
|
||||
let uuid : UUID
|
||||
let name : String
|
||||
let name : String?
|
||||
let lentTo : String?
|
||||
let isDigital : Bool
|
||||
let inWishlist : Bool
|
||||
let isFinished : Bool
|
||||
let finishedDate : Date?
|
||||
let notes : String?
|
||||
let createdAt : String
|
||||
let pickupDescription : String?
|
||||
@@ -222,7 +223,7 @@ struct BHLGameSeries : Decodable {
|
||||
|
||||
struct BHLConsole : Decodable {
|
||||
let uuid : UUID
|
||||
let name : String
|
||||
let name : String?
|
||||
let logo_icloud_path : String?
|
||||
let manufacturer : String?
|
||||
let releaseDate : Date
|
||||
|
||||
Reference in New Issue
Block a user