Skip to content

Commit

Permalink
feat(participationType filter): added participationType filter for me…
Browse files Browse the repository at this point in the history
…mber and team
  • Loading branch information
navneethkrish committed Dec 20, 2024
1 parent 841256b commit 794e282
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 5 additions & 1 deletion apps/web-api/src/members/members.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export class MemberController {
const queryParams = request.query;
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(queryParams);
const { name__icontains } = queryParams;
const { name__icontains, isHost, isSpeaker } = queryParams;
if (name__icontains) {
delete builtQuery.where?.name;
}
if (isHost || isSpeaker) {
delete builtQuery.where?.isHost;
delete builtQuery.where?.isSpeaker;
}
builtQuery.where = {
AND: [
builtQuery.where,
Expand Down
4 changes: 2 additions & 2 deletions apps/web-api/src/members/members.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class MembersService {
slugURL: true,
startDate: true,
endDate: true,
location:{
location: {
select: {
location: true,
timezone: true,
Expand Down Expand Up @@ -1185,7 +1185,7 @@ export class MembersService {
tx
);
}));

return result;
});
await this.cacheService.reset({ service: 'members' });
Expand Down
8 changes: 6 additions & 2 deletions apps/web-api/src/teams/teams.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ export class TeamsController {
);
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(request.query);
const { focusAreas }: any = request.query;
const { focusAreas, isHost } : any = request.query;
if(isHost) {
delete builtQuery.where?.isHost;
}
builtQuery.where = {
AND: [
builtQuery.where ? builtQuery.where : {},
this.teamsService.buildFocusAreaFilters(focusAreas),
this.teamsService.buildRecentTeamsFilter(request.query)
this.teamsService.buildRecentTeamsFilter(request.query),
this.teamsService.buildParticipationTypeFilter(request.query)
]
}
return this.teamsService.findAll(builtQuery);
Expand Down
2 changes: 1 addition & 1 deletion apps/web-api/src/teams/teams.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TeamsService {
slugURL: true,
startDate: true,
endDate: true,
location:{
location: {
select: {
location: true,
timezone: true,
Expand Down

0 comments on commit 794e282

Please sign in to comment.