feat: add AccountPins

This commit is contained in:
Derrick Hammer 2024-01-17 12:32:50 -05:00
parent cf422aef0e
commit cc61a090b6
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 13 additions and 0 deletions

View File

@ -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
}

View File

@ -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)
}