Skip to content

Commit

Permalink
fix(account): merge results of user.FetchByID
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Mar 8, 2024
1 parent 0157d53 commit 443e50d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions account/accountusecase/accountinteractor/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,20 @@ func NewUserQuery(primary accountrepo.User, repos ...accountrepo.User) *UserQuer
}

func (q *UserQuery) FetchByID(ctx context.Context, ids user.IDList) (user.List, error) {
var us user.List
us := make(user.List, len(ids))
for _, r := range q.repos {
u, err := r.FindByIDs(ctx, ids)
if err != nil {
return nil, err
}
us = append(us, u...)

for i, uu := range u {
if uu != nil && us[i] == nil {
us[i] = uu
}
}
}

return us, nil
}

Expand Down

0 comments on commit 443e50d

Please sign in to comment.