frontend: team registration
This commit is contained in:
parent
bc135d00c5
commit
184714aeeb
10 changed files with 208 additions and 28 deletions
|
|
@ -62,6 +62,10 @@ func GetTeamByInitialName(initialName string) (Team, error) {
|
|||
func CreateTeam(name string, color uint32) (Team, error) {
|
||||
re := regexp.MustCompile("[^a-zA-Z0-9]+")
|
||||
initialName := re.ReplaceAllLiteralString(name, "_")
|
||||
return RegisterTeam(initialName, name, color)
|
||||
}
|
||||
|
||||
func RegisterTeam(initialName string, name string, color uint32) (Team, error) {
|
||||
if res, err := DBExec("INSERT INTO teams (initial_name, name, color) VALUES (?, ?, ?)", initialName, name, color); err != nil {
|
||||
return Team{}, err
|
||||
} else if tid, err := res.LastInsertId(); err != nil {
|
||||
|
|
|
|||
Reference in a new issue