Remove unnecessary code
This commit is contained in:
parent
e860e529f1
commit
1a3190ad40
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue