feat: validate user input for entity names
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
e "github.com/iliadenisov/galaxy/internal/error"
|
||||
"github.com/iliadenisov/galaxy/internal/model/game"
|
||||
"github.com/iliadenisov/galaxy/internal/util"
|
||||
)
|
||||
|
||||
func (c *Controller) CreateScience(raceName, typeName string, drive, weapons, shields, cargo float64) error {
|
||||
@@ -19,7 +20,7 @@ func (c *Controller) CreateScience(raceName, typeName string, drive, weapons, sh
|
||||
|
||||
func (c *Cache) CreateScience(ri int, name string, drive, weapons, shileds, cargo float64) error {
|
||||
c.validateRaceIndex(ri)
|
||||
n, ok := validateTypeName(name)
|
||||
n, ok := util.ValidateTypeName(name)
|
||||
if !ok {
|
||||
return e.NewEntityTypeNameValidationError("%q", n)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user