diff --git a/account/account.go b/account/account.go index 3577ead..23eb741 100644 --- a/account/account.go +++ b/account/account.go @@ -32,6 +32,14 @@ func (s AccountServiceImpl) PubkeyExists(pubkey string) (bool, models.PublicKey) return result.RowsAffected > 0, model } + +func (s AccountServiceImpl) AccountExists(id uint64) (bool, models.User) { + var model models.User + + result := s.portal.Database().Model(&models.User{}).First(&model, id) + + return result.RowsAffected > 0, model +} func (s AccountServiceImpl) CreateAccount(email string, password string) (*models.User, error) { var user models.User diff --git a/interfaces/account.go b/interfaces/account.go index 696d47d..94e9901 100644 --- a/interfaces/account.go +++ b/interfaces/account.go @@ -5,6 +5,7 @@ import "git.lumeweb.com/LumeWeb/portal/db/models" type AccountService interface { EmailExists(email string) (bool, models.User) PubkeyExists(pubkey string) (bool, models.PublicKey) + AccountExists(id uint64) (bool, models.User) CreateAccount(email string, password string) (*models.User, error) AddPubkeyToAccount(user models.User, pubkey string) error LoginPassword(email string, password string) (string, error)