Skip to content

Commit

Permalink
Merge branch 'develop' into feat/irl-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
madan-ideas2it authored Dec 20, 2024
2 parents 0c237e1 + 2c6c8d4 commit ade8d09
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function FooterButtons(props) {
Are you sure you want to reject?
</div>
<div className='text-sm font-normal leading-5 text-left'>
Clicking reject will remove the member from the list.
Clicking reject will remove the people from the list.
</div>

<div className="flex gap-[8px] mt-[25px] justify-end">
Expand Down
2 changes: 1 addition & 1 deletion apps/back-office/components/member-request-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MemberRequestList = (props: any) => {
};
const [listData, unVerifiedMembers] = await Promise.all([
api.get(`${API_ROUTE.PARTICIPANTS_REQUEST}?status=PENDING`, config),
api.get(`${API_ROUTE.MEMBERS}?isVerified=false&pagination=false`, config),
api.get(`${API_ROUTE.MEMBERS}?isVerified=false&pagination=false&orderBy=-createdAt`, config),
]);

const pendingMembers = listData.data.filter((item) => item.participantType === ENROLLMENT_TYPE.MEMBER);
Expand Down
2 changes: 1 addition & 1 deletion apps/back-office/components/member-table/member-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const MemberTable = (props: any) => {
Are you sure you want to reject?
</div>
<div className='text-sm font-normal leading-5 text-left'>
Clicking reject will remove the member from the list.
Clicking reject will remove the people from the list.
</div>

<div className="flex gap-[8px] mt-[25px] justify-end">
Expand Down
4 changes: 2 additions & 2 deletions apps/back-office/components/members/memberskillform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function AddMemberSkillForm(props) {
<InformationCircleIcon />
</div>
<span className="pl-1.5 text-[13px] leading-[18px] text-[#0F172A] opacity-40">
Sharing your skills help other network members & teams connect with
Sharing your skills help other network people & teams connect with
you.
</span>
</div>
Expand Down Expand Up @@ -115,7 +115,7 @@ export default function AddMemberSkillForm(props) {
</div>
<span className="pl-1.5 text-[13px] leading-[18px] text-[#0F172A] opacity-40">
Enabling this implies you are open to collaborate on shared ideas
& projects with other members. This is one way to join forces &
& projects with other people. This is one way to join forces &
reach a common goal.
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/back-office/components/teams/teamstepone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function TeamStepOne(props) {
</div>
<span className="pl-1.5 text-[13px] leading-[18px] text-[#0F172A] opacity-40">
If your team offers group office hours or open meetings that are
open to the public, please share the link so PLN members can join
open to the public, please share the link so PLN people can join
and learn more.
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/back-office/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const APP_CONSTANTS = {
APPROVED_FLAG: 'APPROVED',
REJECTED_FLAG: 'REJECTED',
CLOSED_FLAG: 'CLOSED',
MEMBER_LABEL: 'Members',
MEMBER_LABEL: 'People',
TEAMS_LABEL: 'Teams',
NO_DATA_AVAILABLE_LABEL: 'No data available',
VIEW_CLOSED_REQUEST_LABEL: 'View closed requests',
Expand Down
32 changes: 26 additions & 6 deletions apps/web-api/src/focus-areas/focus-areas.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ export class FocusAreasService {
async findAll(query) {
const { type } = query;
const result = await this.prisma.focusArea.findMany({
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: this.buildQueryByLevel(4, type, query), // level denotes depth of children.
...this.buildAncestorFocusAreasFilterByType(type, query)
},
orderBy: {
createdAt: "desc"
}
},
});
return result;
}

private buildQueryByLevel(level: number, type, query) {
if (level === 0) {
return {
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: true,
...this.buildAncestorFocusAreasFilterByType(type, query)
},
Expand All @@ -34,7 +42,11 @@ export class FocusAreasService {
};
}
return {
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: this.buildQueryByLevel(level - 1, type, query),
...this.buildAncestorFocusAreasFilterByType(type, query)
},
Expand All @@ -58,7 +70,11 @@ export class FocusAreasService {
select: {
uid: true,
name: true,
logo: true
logo: {
select: {
url: true
}
}
}
}
},
Expand All @@ -79,7 +95,11 @@ export class FocusAreasService {
select: {
uid: true,
name: true,
logo: true
logo: {
select: {
url: true
}
}
}
}
},
Expand Down
34 changes: 33 additions & 1 deletion apps/web-api/src/members/members.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,34 @@ export class MembersService {
},
},
},
eventGuests: {
orderBy: {
event: {
startDate: 'desc'
},
},
select: {
uid: true,
isHost: true,
isSpeaker: true,
event: {
select: {
uid: true,
name: true,
type: true,
slugURL: true,
startDate: true,
endDate: true,
location:{
select: {
location: true,
timezone: true,
}
},
}
},
},
},
},
});
} catch (error) {
Expand Down Expand Up @@ -1127,7 +1155,7 @@ export class MembersService {
* @returns result
*/
async verifyMembers(memberIds: string[], userEmail): Promise<any> {
return await this.prisma.$transaction(async (tx) => {
const response = await this.prisma.$transaction(async (tx) => {
const result = await tx.member.updateMany({
where: { uid: { in: memberIds } },
data: {
Expand Down Expand Up @@ -1157,8 +1185,11 @@ export class MembersService {
tx
);
}));

return result;
});
await this.cacheService.reset({ service: 'members' });
return response;
}

/**
Expand Down Expand Up @@ -1427,6 +1458,7 @@ export class MembersService {
): Promise<Member> {
if (member[field] !== newValue) {
member = await this.updateMemberByUid(member.uid, { [field]: newValue }, tx);
await this.cacheService.reset({ service: 'members' });
}
return member;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ export class ParticipantsRequestService {
}
})
);
await this.cacheService.reset({ service: "participants-requests" });
return { count: successCount, results };
}
}
5 changes: 3 additions & 2 deletions apps/web-api/src/pl-events/pl-events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { NoCache } from '../decorators/no-cache.decorator';
import { MembersService } from '../members/members.service';
import { PLEventLocationsService } from './pl-event-locations.service';
import { PLEventGuestsService } from './pl-event-guests.service';
import { isEmpty } from 'lodash';

const server = initNestServer(apiEvents);
type RouteShape = typeof server.routeShapes;
Expand Down Expand Up @@ -90,7 +91,7 @@ export class PLEventsController {
const member: any = await this.memberService.findMemberByEmail(request["userEmail"]);
const result = await this.memberService.isMemberPartOfTeams(member, [body.teamUid]) ||
await this.memberService.checkIfAdminUser(member);
if (!result) {
if (!result && !isEmpty(body.teamUid) ) {
throw new ForbiddenException(`Member with email ${userEmail} is not part of
team with uid ${body.teamUid} or isn't admin.`);
}
Expand All @@ -117,7 +118,7 @@ export class PLEventsController {
const member: any = await this.memberService.findMemberByEmail(request["userEmail"]);
const result = await this.memberService.isMemberPartOfTeams(member, [body.teamUid]) ||
await this.memberService.checkIfAdminUser(member);
if (!result) {
if (!result && !isEmpty(body.teamUid)) {
throw new ForbiddenException(`Member with email ${userEmail} is not part of team with uid ${body.teamUid} or isn't admin`);
}
const location = await this.eventLocationService.getPLEventLocationByUid(locationUid);
Expand Down
29 changes: 29 additions & 0 deletions apps/web-api/src/teams/teams.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,35 @@ export class TeamsService {
focusArea: { select: { uid: true, title: true } },
},
},
eventGuests: {
orderBy: {
event: {
startDate: 'desc'
},
},
where: {
isHost: true,
},
distinct: ['eventUid'],
select: {
event: {
select: {
uid: true,
name: true,
type: true,
slugURL: true,
startDate: true,
endDate: true,
location:{
select: {
location: true,
timezone: true,
}
},
}
},
},
},
},
});
team.teamFocusAreas = this.removeDuplicateFocusAreas(team.teamFocusAreas);
Expand Down

0 comments on commit ade8d09

Please sign in to comment.