Skip to content

Commit

Permalink
add ErrNoUsersSpecified error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nourbalaha committed Oct 21, 2024
1 parent 94a30df commit 96a185e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions account/accountusecase/accountinteractor/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ func (i *Workspace) RemoveMultipleUserMembers(ctx context.Context, id workspace.
return nil, accountinterfaces.ErrInvalidOperator
}

if userIds.Len() == 0 {
return nil, accountinterfaces.ErrNoUsersSpecified
}

return Run1(ctx, operator, i.repos, Usecase().Transaction(), func(ctx context.Context) (*workspace.Workspace, error) {
ws, err := i.repos.Workspace.FindByID(ctx, id)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions account/accountusecase/accountinterfaces/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ import (
var (
ErrOperationDenied error = rerror.NewE(i18n.T("operation denied"))
ErrInvalidOperator error = rerror.NewE(i18n.T("invalid operator"))
ErrNoUsersSpecified error = rerror.NewE(i18n.T("no users specified for removal"))
)

0 comments on commit 96a185e

Please sign in to comment.