TheMathemagicians/sevenkeys/logic/import.go

28 lines
530 B
Go

package logic
import (
"database/sql"
"sevenkeys/database"
"sevenkeys/delverlens"
)
func ImportDelverLensCards(db *sql.DB, cards []delverlens.DelverLensCard, storageAreaId int) error {
for _, card := range cards {
var cardPrintingId string
if card.IsFoil {
cardPrintingId = card.ScryfallID + "f"
} else {
cardPrintingId = card.ScryfallID + "n"
}
cardLocation := database.CardLocation{
CardPrintingId: cardPrintingId,
StorageAreaId: storageAreaId,
}
StoreCard(db, cardLocation)
}
return nil
}