Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
ためしにID固定
Browse files Browse the repository at this point in the history
  • Loading branch information
acidlemon committed Nov 25, 2023
1 parent 7e4c842 commit dd2916b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions webapp/go/user_handler.go
Expand Up @@ -144,22 +144,22 @@ func postIconHandler(c echo.Context) error {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to delete old user icon: "+err.Error())
}

rs, err := tx.ExecContext(ctx, "INSERT INTO icons (user_id, image) VALUES (?, ?)", userID, req.Image)
_, err = tx.ExecContext(ctx, "INSERT INTO icons (user_id, image) VALUES (?, ?)", userID, req.Image)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to insert new user icon: "+err.Error())
}

iconID, err := rs.LastInsertId()
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to get last inserted icon id: "+err.Error())
}
// iconID, err := rs.LastInsertId()
// if err != nil {
// return echo.NewHTTPError(http.StatusInternalServerError, "failed to get last inserted icon id: "+err.Error())
// }

if err := tx.Commit(); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to commit: "+err.Error())
}

return c.JSON(http.StatusCreated, &PostIconResponse{
ID: iconID,
ID: 32,
})
}

Expand Down

0 comments on commit dd2916b

Please sign in to comment.