feat: add AccountExists method
This commit is contained in:
parent
ae0bddf3d1
commit
4ae272205a
|
@ -32,6 +32,14 @@ func (s AccountServiceImpl) PubkeyExists(pubkey string) (bool, models.PublicKey)
|
||||||
|
|
||||||
return result.RowsAffected > 0, model
|
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) {
|
func (s AccountServiceImpl) CreateAccount(email string, password string) (*models.User, error) {
|
||||||
var user models.User
|
var user models.User
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import "git.lumeweb.com/LumeWeb/portal/db/models"
|
||||||
type AccountService interface {
|
type AccountService interface {
|
||||||
EmailExists(email string) (bool, models.User)
|
EmailExists(email string) (bool, models.User)
|
||||||
PubkeyExists(pubkey string) (bool, models.PublicKey)
|
PubkeyExists(pubkey string) (bool, models.PublicKey)
|
||||||
|
AccountExists(id uint64) (bool, models.User)
|
||||||
CreateAccount(email string, password string) (*models.User, error)
|
CreateAccount(email string, password string) (*models.User, error)
|
||||||
AddPubkeyToAccount(user models.User, pubkey string) error
|
AddPubkeyToAccount(user models.User, pubkey string) error
|
||||||
LoginPassword(email string, password string) (string, error)
|
LoginPassword(email string, password string) (string, error)
|
||||||
|
|
Loading…
Reference in New Issue