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

Commit dd2916b

Browse files
committed
ためしにID固定
1 parent 7e4c842 commit dd2916b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

webapp/go/user_handler.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,22 @@ func postIconHandler(c echo.Context) error {
144144
return echo.NewHTTPError(http.StatusInternalServerError, "failed to delete old user icon: "+err.Error())
145145
}
146146

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

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

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

161161
return c.JSON(http.StatusCreated, &PostIconResponse{
162-
ID: iconID,
162+
ID: 32,
163163
})
164164
}
165165

0 commit comments

Comments
 (0)