Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improved performance of modify guest #1928

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions apps/web-api/src/pl-events/pl-event-guests.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class PLEventGuestsService {
data.memberUid = isAdmin ? data.memberUid : member.uid;
const guests = this.formatInputToEventGuests(data);
const result = await (tx || this.prisma).pLEventGuest.createMany({ data: guests });
await this.cacheService.reset();
this.cacheService.reset();
return result;
} catch(err) {
this.handleErrors(err);
Expand Down Expand Up @@ -151,16 +151,16 @@ export class PLEventGuestsService {
description: true,
startDate: true,
endDate: true,
logo: true,
banner: true,
logo: { select: { url: true } },
banner: { select: { url: true } },
resources: true,
additionalInfo: true
}
},
member: {
select: {
name: true,
image: true,
image: { select: { url: true } },
telegramHandler: isUserLoggedIn ? true : false,
preferences: true,
officeHours: isUserLoggedIn ? true : false,
Expand All @@ -170,7 +170,7 @@ export class PLEventGuestsService {
select:{
uid: true,
name: true,
logo: true
logo: { select: { url: true } }
}
}
}
Expand All @@ -197,7 +197,7 @@ export class PLEventGuestsService {
select:{
uid: true,
name: true,
logo: true
logo: { select: { url: true } }
}
},
createdAt: true,
Expand All @@ -206,7 +206,7 @@ export class PLEventGuestsService {
}
});
this.restrictTelegramBasedOnMemberPreference(result, isUserLoggedIn);
this.restrictOfficeHours(result, isUserLoggedIn);
// this.restrictOfficeHours(result, isUserLoggedIn);
return result;
}
catch(err) {
Expand Down Expand Up @@ -287,10 +287,10 @@ export class PLEventGuestsService {
restrictTelegramBasedOnMemberPreference(eventGuests, isUserLoggedIn: boolean) {
if (isUserLoggedIn && eventGuests) {
eventGuests = eventGuests.map((guest:any) => {
if (!guest.telegramId) {
delete guest.member.telegramHandler;
return guest;
}
// if (!guest.telegramId) {
// delete guest.member.telegramHandler;
// return guest;
// }
if (!guest.member.preferences) {
return guest;
}
Expand Down
14 changes: 7 additions & 7 deletions apps/web-api/src/pl-events/pl-events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export class PLEventsService {
const plEvent = await this.prisma.pLEvent.findUniqueOrThrow({
where: { slugURL: slug },
include: {
logo: true,
banner: true,
logo: { select: { url: true } },
banner: { select: { url: true } },
eventGuests: {
select: {
uid: true,
Expand All @@ -66,12 +66,12 @@ export class PLEventsService {
officeHours: isUserLoggedIn ? true : false,
event: {
include: {
logo: true
logo: { select: { url: true } }
}
},
member: {
select:{
image: true,
image: { select: { url: true } },
name: true,
preferences: true,
telegramHandler: isUserLoggedIn ? true : false,
Expand All @@ -82,7 +82,7 @@ export class PLEventsService {
select:{
uid: true,
name: true,
logo: true
logo: { select: { url: true } }
}
}
}
Expand All @@ -109,7 +109,7 @@ export class PLEventsService {
select:{
uid: true,
name: true,
logo: true
logo: { select: { url: true } }
}
}
}
Expand All @@ -119,7 +119,7 @@ export class PLEventsService {
if (plEvent) {
this.filterPrivateResources(plEvent, isUserLoggedIn);
plEvent.eventGuests = this.eventGuestsService.restrictTelegramBasedOnMemberPreference(plEvent?.eventGuests, isUserLoggedIn);
plEvent.eventGuests = this.eventGuestsService.restrictOfficeHours(plEvent?.eventGuests, isUserLoggedIn);
// plEvent.eventGuests = this.eventGuestsService.restrictOfficeHours(plEvent?.eventGuests, isUserLoggedIn);
}
return plEvent;
} catch(err) {
Expand Down
Loading