sms alarming flag

This commit is contained in:
Julian Krauser 2024-11-27 10:07:59 +01:00
parent 1d73a15227
commit 5c68f0c54f
14 changed files with 90 additions and 3 deletions

View file

@ -346,6 +346,7 @@ export async function addExecutivePositionToMember(req: Request, res: Response):
export async function addCommunicationToMember(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId);
const preferred = req.body.preferred;
const isSMSAlarming = req.body.isSMSAlarming;
const mobile = req.body.mobile;
const email = req.body.email;
const city = req.body.city;
@ -357,6 +358,7 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
let createCommunication: CreateCommunicationCommand = {
preferred,
isSMSAlarming,
mobile,
email,
city,
@ -528,6 +530,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
const memberId = parseInt(req.params.memberId);
const recordId = parseInt(req.params.recordId);
const preferred = req.body.preferred;
const isSMSAlarming = req.body.isSMSAlarming;
const mobile = req.body.mobile;
const email = req.body.email;
const city = req.body.city;
@ -540,6 +543,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
let updateCommunication: UpdateCommunicationCommand = {
id: recordId,
preferred,
isSMSAlarming,
mobile,
email,
city,
@ -550,12 +554,16 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
};
await CommunicationCommandHandler.update(updateCommunication);
let currentUserNewsletterMain = await MemberService.getNewsletterById(memberId);
if (isNewsletterMain) {
let updateNewsletter: UpdateMemberNewsletterCommand = {
id: memberId,
communicationId: recordId,
};
await MemberCommandHandler.updateNewsletter(updateNewsletter);
} else if (currentUserNewsletterMain.sendNewsletter.id == recordId) {
await MemberCommandHandler.unsetNewsletter(memberId);
}
res.sendStatus(204);