diff --git a/account/account.go b/account/account.go index 23eb741..12ee393 100644 --- a/account/account.go +++ b/account/account.go @@ -111,3 +111,15 @@ func (s AccountServiceImpl) LoginPubkey(pubkey string) (string, error) { return token, nil } + +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) + + if result.Error != nil { + return nil, result.Error + } + + return pins, nil +} diff --git a/interfaces/account.go b/interfaces/account.go index 94e9901..7e9ff5b 100644 --- a/interfaces/account.go +++ b/interfaces/account.go @@ -10,4 +10,5 @@ type AccountService interface { AddPubkeyToAccount(user models.User, pubkey string) error LoginPassword(email string, password string) (string, error) LoginPubkey(pubkey string) (string, error) + AccountPins(id uint64, createdAfter uint64) ([]models.Pin, error) }