summaryrefslogtreecommitdiff
path: root/handlers/handlers.go
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-11-28 15:43:34 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-11-28 15:43:34 +0530
commit6461eba5e8df73aab7fd325e026dac6fb7e77524 (patch)
tree8fd9cbdb8b2f842720056cffbff89fb969a48d29 /handlers/handlers.go
parent82d5136c1b03efbb99931884dd75ab1160689ceb (diff)
handlers - no variables + removing comments
Diffstat (limited to 'handlers/handlers.go')
-rw-r--r--handlers/handlers.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/handlers/handlers.go b/handlers/handlers.go
index f350589..fd5395d 100644
--- a/handlers/handlers.go
+++ b/handlers/handlers.go
@@ -58,18 +58,16 @@ func AddHash(c echo.Context) error {
}
// Store id and hash in the database
- _, err := db.Exec("INSERT INTO hashes (ID, HashValue) VALUES (?, ?)", id, hash)
+ _, err = db.Exec("INSERT INTO hashes (ID, HashValue) VALUES (?, ?)", id, hash)
if err != nil {
log.Println("Failed to insert into database:", err)
- //return c.JSON(http.StatusInternalServerError, map[string]string{"message": "Failed to store hash"})
}
- //return c.JSON(http.StatusOK, map[string]string{"id": id, "message": "Hash added successfully"})
data := models.FileHashPair{
ID: id,
FileHash: hash,
}
- log.Println("Hash added successfully")
+ log.Println("Hash added successfully to the database")
return c.JSON(http.StatusOK, data)
}