From 1812b9cd38a8de0bd55744c3bfda1cc024b1a19e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 16 Feb 2024 21:57:20 -0500 Subject: [PATCH] refactor: change PinByHash to take hash in byte form --- account/account.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account/account.go b/account/account.go index f8dad08..5dd52bb 100644 --- a/account/account.go +++ b/account/account.go @@ -2,6 +2,7 @@ package account import ( "crypto/ed25519" + "encoding/hex" "errors" "time" @@ -280,9 +281,10 @@ func (s AccountServiceDefault) DeletePinByHash(hash string, userId uint) error { return nil } -func (s AccountServiceDefault) PinByHash(hash string, userId uint) error { +func (s AccountServiceDefault) PinByHash(hash []byte, userId uint) error { + hashStr := hex.EncodeToString(hash) // Define a struct for the query condition - uploadQuery := models.Upload{Hash: hash} + uploadQuery := models.Upload{Hash: hashStr} // Retrieve the upload ID for the given hash var uploadID uint