Filter groups given a member (#5034)

* feat: filter groups given a member

* Revert "feat: filter groups given a member"

This reverts commit 7dac8bb38de1fdaf661c636c5d1b13e4112fd8fd.

* fix: make it work via db query
This commit is contained in:
Apoorv Mishra
2023-03-16 12:31:56 +05:30
committed by GitHub
parent 6a29104d09
commit 21a44428f4
4 changed files with 86 additions and 2 deletions

View File

@@ -23,10 +23,10 @@ router.post(
pagination(),
validate(T.GroupsListSchema),
async (ctx: APIContext<T.GroupsListReq>) => {
const { direction, sort } = ctx.input.body;
const { direction, sort, userId } = ctx.input.body;
const { user } = ctx.state.auth;
const groups = await Group.findAll({
const groups = await Group.filterByMember(userId).findAll({
where: {
teamId: user.teamId,
},