refactor: use uint and param consistency changes

This commit is contained in:
Derrick Hammer 2024-02-13 23:29:36 -05:00
parent 96758a5559
commit 634a285ea8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -214,12 +214,12 @@ func (s AccountServiceDefault) LoginPubkey(pubkey string) (string, error) {
return token, nil 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 var pins []models.Pin
result := s.db.Model(&models.Pin{}). result := s.db.Model(&models.Pin{}).
Preload("Upload"). // Preload the related Upload for each 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). Where("created_at > ?", createdAfter).
Order("created_at desc"). Order("created_at desc").
Find(&pins) Find(&pins)
@ -231,7 +231,7 @@ func (s AccountServiceDefault) AccountPins(id uint64, createdAfter uint64) ([]mo
return pins, nil 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 // Define a struct for the query condition
uploadQuery := models.Upload{Hash: hash} 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 // 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. result = s.db.
Where(&pinQuery). Where(&pinQuery).
Delete(&models.Pin{}) Delete(&models.Pin{})