mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-18 00:42:29 +00:00
feat: apiurls, passwordpolicy, userbyid (#507)
* feat: api doc request * feat: return zitadel docs * feat: return zitadel docs * feat: pw policy min length * feat: pw policy min length * fix: semantic * fix: read missing events on user by id
This commit is contained in:
@@ -2,6 +2,7 @@ package eventstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
|
||||
"github.com/caos/logging"
|
||||
|
||||
@@ -23,13 +24,19 @@ type UserRepo struct {
|
||||
}
|
||||
|
||||
func (repo *UserRepo) UserByID(ctx context.Context, id string) (*usr_model.UserView, error) {
|
||||
user, err := repo.View.UserByID(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
user, viewErr := repo.View.UserByID(id)
|
||||
if viewErr != nil && !caos_errs.IsNotFound(viewErr) {
|
||||
return nil, viewErr
|
||||
}
|
||||
events, err := repo.UserEvents.UserEventsByID(ctx, id, user.Sequence)
|
||||
if err != nil {
|
||||
logging.Log("EVENT-PSoc3").WithError(err).Debug("error retrieving new events")
|
||||
if caos_errs.IsNotFound(viewErr) {
|
||||
user = new(model.UserView)
|
||||
}
|
||||
events, esErr := repo.UserEvents.UserEventsByID(ctx, id, user.Sequence)
|
||||
if caos_errs.IsNotFound(viewErr) && len(events) == 0 {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "EVENT-Lsoj7", "Errors.User.NotFound")
|
||||
}
|
||||
if esErr != nil {
|
||||
logging.Log("EVENT-PSoc3").WithError(esErr).Debug("error retrieving new events")
|
||||
return model.UserToModel(user), nil
|
||||
}
|
||||
userCopy := *user
|
||||
|
Reference in New Issue
Block a user