From 6461eba5e8df73aab7fd325e026dac6fb7e77524 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Tue, 28 Nov 2023 15:43:34 +0530 Subject: handlers - no variables + removing comments --- handlers/handlers.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'handlers') 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) } -- cgit v1.2.3