Skip to content

Commit

Permalink
fix: fixed telegram, officehours isn't updated in event guest
Browse files Browse the repository at this point in the history
  - imporve performance of modify guest
  • Loading branch information
navneethkrish committed Oct 16, 2024
1 parent d6164e4 commit 9f33adc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions apps/web-api/src/pl-events/pl-event-guests.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export class PLEventGuestsService {
) {
try {
const isAdmin = this.memberService.checkIfAdminUser(member);
await this.updateMemberDetails(data, member, isAdmin, tx);
this.updateMemberDetails(data, member, isAdmin, tx);
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 All @@ -68,7 +68,7 @@ export class PLEventGuestsService {
const events = type === "upcoming" ? location.upcomingEvents : location.pastEvents;
return await this.prisma.$transaction(async (tx) => {
const isAdmin = this.memberService.checkIfAdminUser(member);
await tx.pLEventGuest.deleteMany({
tx.pLEventGuest.deleteMany({
where: {
memberUid: isAdmin ? data.memberUid : member.uid,
eventUid: {
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion apps/web-api/src/pl-events/pl-events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9f33adc

Please sign in to comment.