Skip to content

Commit

Permalink
arrumando novamente
Browse files Browse the repository at this point in the history
  • Loading branch information
cissavgonc committed Dec 6, 2023
1 parent 0281941 commit 4dfa84f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions readings_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func getAllReadings(w http.ResponseWriter, r *http.Request) {
db := OpenConnection()
defer db.Close()

rows, err := db.Query("SELECT id, user_id, timestamp, value FROM readings")
rows, err := db.Query("SELECT id, userid, value, torquevalues, asmtimes, motionwastes, setvalue FROM readings")
if err != nil {
http.Error(w, "Database query error", http.StatusInternalServerError)
return
Expand All @@ -34,7 +34,7 @@ func getAllReadings(w http.ResponseWriter, r *http.Request) {
var readings []Reading
for rows.Next() {
var reading Reading
err := rows.Scan(&reading.ID, &reading.UserID, &reading.Timestamp, &reading.Value)
err := rows.Scan(reading.UserID, reading.Value, pq.Array(reading.TorqueValues), pq.Array(reading.AsmTimes), pq.Array(reading.MotionWastes), reading.SetValue)
if err != nil {
http.Error(w, "Error scanning readings", http.StatusInternalServerError)
return
Expand Down
2 changes: 1 addition & 1 deletion user_readings_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func UserReadingsHandler(w http.ResponseWriter, r *http.Request) {
}

// Query database for readings belonging to the user
rows, err := db.Query("SELECT id, user_id, timestamp, value, torque_values, asm_times, motion_wastes, set_value FROM readings WHERE user_id = $1", userID)
rows, err := db.Query("SELECT id, userid, timestamp, value, torquevalues, asmtimes, motionwastes, setvalue FROM readings WHERE user_id = $1", userID)
if err != nil {
http.Error(w, "Database query error", http.StatusInternalServerError)
return
Expand Down

0 comments on commit 4dfa84f

Please sign in to comment.