diff --git a/sevenkeys/database/storagearea.go b/sevenkeys/database/storagearea.go index d916fb2..eab522f 100644 --- a/sevenkeys/database/storagearea.go +++ b/sevenkeys/database/storagearea.go @@ -49,17 +49,3 @@ func InsertStorageArea(db *sql.DB, storageArea StorageArea) error { return nil } - -func GetStorageAreaTypeById(db *sql.DB, storageAreaId int) (string, error) { - var storageType string - - query := `SELECT StorageType FROM StorageArea WHERE Id = ?;` - row := db.QueryRow(query, storageAreaId) - - err := row.Scan(&storageType) - if err != nil { - return storageType, err - } - - return storageType, nil -} diff --git a/sevenkeys/logic/remove.go b/sevenkeys/logic/remove.go index be617a6..6e6e6b5 100644 --- a/sevenkeys/logic/remove.go +++ b/sevenkeys/logic/remove.go @@ -10,14 +10,9 @@ import ( var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.") func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error { - locationType, err := database.GetStorageAreaTypeById(db, location.CardLocationId) - if err != nil { - return err - } - - if locationType == database.StorageAreaTypeBinder { + if location.StorageAreaType == database.StorageAreaTypeBinder { database.RemoveFromBinder(db, location) - } else if locationType == database.StorageAreaTypeBox { + } else if location.StorageAreaType == database.StorageAreaTypeBox { database.RemoveFromBox(db, location) } else { return UnrecognizedStorageAreaTypeError