fix: PinByHash does not query right
This commit is contained in:
parent
ae7d048e6c
commit
a77981f0a6
|
@ -284,18 +284,16 @@ func (s AccountServiceDefault) PinByHash(hash []byte, userId uint) error {
|
|||
// Define a struct for the query condition
|
||||
uploadQuery := models.Upload{Hash: hash}
|
||||
|
||||
// Retrieve the upload ID for the given hash
|
||||
var uploadID uint
|
||||
result := s.db.
|
||||
Model(&models.Upload{}).
|
||||
Model(&uploadQuery).
|
||||
Where(&uploadQuery).
|
||||
First(&uploadID)
|
||||
First(&uploadQuery)
|
||||
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
return s.PinByID(uploadID, userId)
|
||||
return s.PinByID(uploadQuery.ID, userId)
|
||||
}
|
||||
|
||||
func (s AccountServiceDefault) PinByID(uploadId uint, userId uint) error {
|
||||
|
|
Loading…
Reference in New Issue