mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:57:33 +00:00
refactor: rename package errors to zerrors (#7039)
* chore: rename package errors to zerrors * rename package errors to gerrors * fix error related linting issues * fix zitadel error assertion * fix gosimple linting issues * fix deprecated linting issues * resolve gci linting issues * fix import structure --------- Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
@@ -4,13 +4,13 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
caos_errs "github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/repository/user"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
func (c *Commands) AddHumanAvatar(ctx context.Context, orgID, userID string, upload *AssetUpload) (*domain.ObjectDetails, error) {
|
||||
if userID == "" {
|
||||
return nil, caos_errs.ThrowInvalidArgument(nil, "USER-Ba5Ds", "Errors.IDMissing")
|
||||
return nil, zerrors.ThrowInvalidArgument(nil, "USER-Ba5Ds", "Errors.IDMissing")
|
||||
}
|
||||
existingUser, err := c.userWriteModelByID(ctx, userID, orgID)
|
||||
if err != nil {
|
||||
@@ -18,11 +18,11 @@ func (c *Commands) AddHumanAvatar(ctx context.Context, orgID, userID string, upl
|
||||
}
|
||||
|
||||
if existingUser.UserState == domain.UserStateUnspecified || existingUser.UserState == domain.UserStateDeleted {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "USER-vJ3fS", "Errors.Users.NotFound")
|
||||
return nil, zerrors.ThrowNotFound(nil, "USER-vJ3fS", "Errors.Users.NotFound")
|
||||
}
|
||||
asset, err := c.uploadAsset(ctx, upload)
|
||||
if err != nil {
|
||||
return nil, caos_errs.ThrowInternal(err, "USER-1Xyud", "Errors.Assets.Object.PutFailed")
|
||||
return nil, zerrors.ThrowInternal(err, "USER-1Xyud", "Errors.Assets.Object.PutFailed")
|
||||
}
|
||||
userAgg := UserAggregateFromWriteModel(&existingUser.WriteModel)
|
||||
pushedEvents, err := c.eventstore.Push(ctx, user.NewHumanAvatarAddedEvent(ctx, userAgg, asset.VersionedName()))
|
||||
@@ -38,14 +38,14 @@ func (c *Commands) AddHumanAvatar(ctx context.Context, orgID, userID string, upl
|
||||
|
||||
func (c *Commands) RemoveHumanAvatar(ctx context.Context, orgID, userID string) (*domain.ObjectDetails, error) {
|
||||
if userID == "" {
|
||||
return nil, caos_errs.ThrowInvalidArgument(nil, "USER-1B8sd", "Errors.IDMissing")
|
||||
return nil, zerrors.ThrowInvalidArgument(nil, "USER-1B8sd", "Errors.IDMissing")
|
||||
}
|
||||
existingUser, err := c.getHumanWriteModelByID(ctx, userID, orgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if existingUser.UserState == domain.UserStateUnspecified || existingUser.UserState == domain.UserStateDeleted {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "USER-35N8f", "Errors.Users.NotFound")
|
||||
return nil, zerrors.ThrowNotFound(nil, "USER-35N8f", "Errors.Users.NotFound")
|
||||
}
|
||||
err = c.removeAsset(ctx, orgID, existingUser.Avatar)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user