diff --git a/dbi/user.go b/dbi/user.go index 9201ed7..8408747 100644 --- a/dbi/user.go +++ b/dbi/user.go @@ -16,6 +16,9 @@ type User struct { } func CreateUser(conn *sql.Conn, user *User) error { + if user.APIKey == "" { + user.APIKey = GenUUID() + } _, err := conn.ExecContext(context.Background(), `INSERT INTO users (APIKey, FirstName, LastName, Password, Status, Username) VALUES (?, ?, ?, ?, ?, ?)`,