fix: possibly undefined newsletter com

This commit is contained in:
Julian Krauser 2025-01-10 11:26:48 +01:00
parent 55d4a952c3
commit c173f917e3

View file

@ -48,8 +48,8 @@ import {
UpdateCommunicationCommand,
} from "../../../command/club/member/communicationCommand";
import CommunicationCommandHandler from "../../../command/club/member/communicationCommandHandler";
import {PdfExport} from "../../../helpers/pdfExport";
import {PermissionModule} from "../../../type/permissionTypes";
import { PdfExport } from "../../../helpers/pdfExport";
import { PermissionModule } from "../../../type/permissionTypes";
/**
* @description get all members
@ -227,14 +227,14 @@ export async function getCommunicationByMemberAndRecord(req: Request, res: Respo
* @returns {Promise<*>}
*/
export async function createMemberPrintoutList(req: Request, res: Response): Promise<any> {
let members = await MemberService.getByRunningMembership()
let members = await MemberService.getByRunningMembership();
let pdf = await PdfExport.renderFile({
title: "Mitgliederliste",
template: "member.list",
saveToDisk: false,
data: {
member: members
member: members,
},
});
@ -596,7 +596,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
communicationId: recordId,
};
await MemberCommandHandler.updateNewsletter(updateNewsletter);
} else if (currentUserNewsletterMain.sendNewsletter.id == recordId) {
} else if (currentUserNewsletterMain.sendNewsletter?.id == recordId) {
await MemberCommandHandler.unsetNewsletter(memberId);
}