Remove unnecessary code

This commit is contained in:
The Magician 2024-09-13 12:33:20 +01:00
parent e860e529f1
commit 1a3190ad40
2 changed files with 2 additions and 21 deletions

View File

@ -49,17 +49,3 @@ func InsertStorageArea(db *sql.DB, storageArea StorageArea) error {
return nil 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
}

View File

@ -10,14 +10,9 @@ import (
var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.") var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.")
func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error { func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error {
locationType, err := database.GetStorageAreaTypeById(db, location.CardLocationId) if location.StorageAreaType == database.StorageAreaTypeBinder {
if err != nil {
return err
}
if locationType == database.StorageAreaTypeBinder {
database.RemoveFromBinder(db, location) database.RemoveFromBinder(db, location)
} else if locationType == database.StorageAreaTypeBox { } else if location.StorageAreaType == database.StorageAreaTypeBox {
database.RemoveFromBox(db, location) database.RemoveFromBox(db, location)
} else { } else {
return UnrecognizedStorageAreaTypeError return UnrecognizedStorageAreaTypeError