Skip to content

Commit

Permalink
fix: add omit private foelds for user list endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrChabatul committed Aug 7, 2024
1 parent 949441e commit cec7efd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion template/apps/api/src/resources/user/actions/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ async function handler(ctx: AppKoaContext<ValidatedData>) {
});
}

ctx.body = await userService.find(
const result = await userService.find(
{ ...(filterOptions.length && { $and: filterOptions }) },
{ page, perPage },
{ sort },
);

ctx.body = {...result, results: result.results.map(userService.getPublic)};
}

export default (router: AppRouter) => {
Expand Down

0 comments on commit cec7efd

Please sign in to comment.