fix: preload uploads
This commit is contained in:
parent
60c905181c
commit
9b655b4a70
|
@ -116,7 +116,12 @@ func (s AccountServiceImpl) LoginPubkey(pubkey string) (string, error) {
|
|||
func (s AccountServiceImpl) AccountPins(id uint64, createdAfter uint64) ([]models.Pin, error) {
|
||||
var pins []models.Pin
|
||||
|
||||
result := s.portal.Database().Model(&models.Pin{}).Where(&models.Pin{UserID: uint(id)}).Where("created_at > ?", createdAfter).Order("created_at desc").Find(&pins)
|
||||
result := s.portal.Database().Model(&models.Pin{}).
|
||||
Preload("Upload"). // Preload the related Upload for each Pin
|
||||
Where(&models.Pin{UserID: uint(id)}).
|
||||
Where("created_at > ?", createdAfter).
|
||||
Order("created_at desc").
|
||||
Find(&pins)
|
||||
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
|
|
Loading…
Reference in New Issue