feat: remove phone (#349)

* feat: remove phone number

* feat: remove phone number tests

* feat: remove phone number tests

* fix: regenerate protos
This commit is contained in:
Fabi
2020-07-06 15:48:24 +02:00
committed by GitHub
parent 0e1ef5758a
commit c8cdbe136c
31 changed files with 1947 additions and 1430 deletions

View File

@@ -895,6 +895,22 @@ func (es *UserEventstore) PhoneVerificationCodeSent(ctx context.Context, userID
return nil
}
func (es *UserEventstore) RemovePhone(ctx context.Context, userID string) error {
existing, err := es.UserByID(ctx, userID)
if err != nil {
return err
}
repoExisting := model.UserFromModel(existing)
removeAggregate := PhoneRemovedAggregate(es.AggregateCreator(), repoExisting)
err = es_sdk.Push(ctx, es.PushAggregates, repoExisting.AppendEvents, removeAggregate)
if err != nil {
return err
}
es.userCache.cacheUser(repoExisting)
return nil
}
func (es *UserEventstore) AddressByID(ctx context.Context, userID string) (*usr_model.Address, error) {
if userID == "" {
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-di8ws", "Errors.User.UserIDMissing")