Skip to content

Commit

Permalink
Fix signup handler
Browse files Browse the repository at this point in the history
Was leaving ephemeral_statuses nil, and that was causing issues. Now
sets it to an empty json object
  • Loading branch information
Muirrum committed Oct 26, 2023
1 parent 99a7d7b commit d5eadeb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/handlers/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ func Signup(c *fiber.Ctx) error {
}
log.Println("Creating new stead...")
inv, _ := json.Marshal(starting_inventory)
statuses, _ := json.Marshal(map[string]interface{}{})
log.Printf("Username: %s", u.Username)
_, err = tx.Exec("INSERT INTO stead (username, password, inventory) VALUES ($1, $2, $3)", u.Username, pw_hash, inv)
_, err = tx.Exec("INSERT INTO stead (username, password, inventory, ephemeral_statuses) VALUES ($1, $2, $3, $4)", u.Username, pw_hash, inv, statuses)
if err != nil {
tx.Rollback()
return err
Expand Down

0 comments on commit d5eadeb

Please sign in to comment.