Fix swagger deps

This commit is contained in:
Florian Hoss 2023-07-04 23:18:05 +02:00
parent 28f068c890
commit f63210272d
28 changed files with 307 additions and 310 deletions

View file

@ -3,7 +3,6 @@ package controller
import (
"fmt"
"gitlab.unjx.de/flohoss/cafe-plaetschwiesle/internal/types"
"gorm.io/plugin/soft_delete"
)
@ -42,7 +41,7 @@ func (c *Controller) CreateNewTable() (Table, error) {
err = c.orm.Unscoped().Save(&table).Error
}
if err != nil {
return table, fmt.Errorf(types.CannotCreate.String())
return table, fmt.Errorf(CannotCreate.String())
}
return table, nil
}
@ -61,14 +60,14 @@ func (c *Controller) DeleteLatestTable() error {
"tables.id",
).Last(&table).Error
if err != nil {
return fmt.Errorf(types.CannotFind.String())
return fmt.Errorf(CannotFind.String())
}
if table.OrderCount != 0 {
return fmt.Errorf(types.StillInUse.String())
return fmt.Errorf(StillInUse.String())
}
err = c.orm.Delete(&table).Error
if err != nil {
return fmt.Errorf(types.CannotDelete.String())
return fmt.Errorf(CannotDelete.String())
}
return nil
}