Add missing gRPC functions

This commit is contained in:
2022-08-11 17:14:21 +02:00
parent 26090e9299
commit 6530d024f8
12 changed files with 448 additions and 164 deletions

View File

@@ -32,6 +32,7 @@ type DBStorage interface {
GetAccount(id string) (*Account, error)
LocalAuthentication(namespace string, username string, email string, phone_number string) (*Account, error)
GetAccounts(namespaces []string) ([]Account, error)
GetAccountsByIds(accountids []string) ([]Account, error)
CreateAccount(account Account) error
UpdateAccount(account Account) error
}
@@ -62,32 +63,3 @@ func NewKVStore(cfg *viper.Viper) (KVStore, error) {
kv, err := NewEtcdKVStore(cfg)
return kv, err
}
// Data models
type Account struct {
ID string `json:"id" bson:"_id"`
Namespace string `json:"namespace"`
Authentication AccountAuth `json:"authentication" bson:"authentication"`
Data map[string]any `json:"data"`
Metadata map[string]any `json:"metadata"`
}
type AccountAuth struct {
Local LocalAuth
//TODO handle SSO
}
type LocalAuth struct {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
EmailValidation Validation `json:"email_validation" bson:"email_validation"`
PhoneNumber string `json:"phone_number" bson:"phone_number"`
PhoneNumberValidation Validation `json:"phone_number_validation" bson:"phone_number_validation"`
}
type Validation struct {
Validated bool
ValidationCode string `json:"validation_code" bson:"validation_code"`
}