Skip to content

Narrow the findUsers result to a minimal UserListItem type - #6219

Open
fraxachun wants to merge 1 commit into
mainfrom
user-list-item
Open

Narrow the findUsers result to a minimal UserListItem type#6219
fraxachun wants to merge 1 commit into
mainfrom
user-list-item

Conversation

@fraxachun

Copy link
Copy Markdown
Contributor

Problem

Some UserServices might provide an enhanced User type with additional information which can be useful in projects. However, in the findUsers-Request for performance reasons the additional information should not be mandatory.

Solution

This PR makes it possible for a UserService to implement this behaviour by only require the core User fields in findUsers().

throw new Error("For this functionality you need to define `findUserOrThrow` (or the deprecated `getUser`) in the userService.");
}

async findUsers(args: FindUsersArgs): Promise<[User[], number]> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findUsers and findUserOrThrow should return the same type. Having to call findUserOrThrow to get a "fullUser" is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants