Skip to content

Commit

Permalink
pr syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Fontanier committed Apr 3, 2024
1 parent 551c5ef commit 7948601
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions front/lib/resources/membership_resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,11 @@ export class MembershipResource extends BaseResource<MembershipModel> {
(resource) => new MembershipResource(MembershipModel, resource.get())
);

const where: WhereOptions<InferAttributes<MembershipModel>> = {};
if (roles) {
where.role = {
[Op.in]: roles,
};
}
if (userIds) {
where.userId = {
[Op.in]: userIds,
};
}
if (workspace) {
where.workspaceId = workspace.id;
}
const where: WhereOptions<InferAttributes<MembershipModel>> = {
role: roles,
userId: userIds ? { [Op.in]: userIds } : undefined,
workspaceId: workspace ? workspace.id : undefined,
};

if (!workspace && !userIds?.length) {
throw new Error("At least one of workspace or userIds must be provided.");
Expand Down

0 comments on commit 7948601

Please sign in to comment.