From 634a285ea8d71dbfbbd29547784eb47032497f70 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 13 Feb 2024 23:29:36 -0500 Subject: [PATCH] refactor: use uint and param consistency changes --- account/account.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/account/account.go b/account/account.go index 1d2bd2d..92ebc09 100644 --- a/account/account.go +++ b/account/account.go @@ -214,12 +214,12 @@ func (s AccountServiceDefault) LoginPubkey(pubkey string) (string, error) { return token, nil } -func (s AccountServiceDefault) AccountPins(id uint64, createdAfter uint64) ([]models.Pin, error) { +func (s AccountServiceDefault) AccountPins(id uint, createdAfter uint64) ([]models.Pin, error) { var pins []models.Pin result := s.db.Model(&models.Pin{}). Preload("Upload"). // Preload the related Upload for each Pin - Where(&models.Pin{UserID: uint(id)}). + Where(&models.Pin{UserID: id}). Where("created_at > ?", createdAfter). Order("created_at desc"). Find(&pins) @@ -231,7 +231,7 @@ func (s AccountServiceDefault) AccountPins(id uint64, createdAfter uint64) ([]mo return pins, nil } -func (s AccountServiceDefault) DeletePinByHash(hash string, accountID uint) error { +func (s AccountServiceDefault) DeletePinByHash(hash string, userId uint) error { // Define a struct for the query condition uploadQuery := models.Upload{Hash: hash} @@ -252,7 +252,7 @@ func (s AccountServiceDefault) DeletePinByHash(hash string, accountID uint) erro } // Delete pins with the retrieved upload ID and matching account ID - pinQuery := models.Pin{UploadID: uploadID, UserID: accountID} + pinQuery := models.Pin{UploadID: uploadID, UserID: userId} result = s.db. Where(&pinQuery). Delete(&models.Pin{})