telegram
parent
db0328747a
commit
4924438698
|
@ -4,6 +4,7 @@ import { newsletterLogger } from "../logger/logger";
|
|||
import { newNewsletterId } from "../utils/utils";
|
||||
import { isEmailValid } from "../validator/validator";
|
||||
import rabbitmq from "../rabbitmq/rabbitmq";
|
||||
import { telegramNotification } from "../utils/adminDashboard";
|
||||
|
||||
const NEWSLETTER_STATE = {
|
||||
NOT_CONFIRMED: 0,
|
||||
|
@ -53,6 +54,11 @@ export async function AddNewsletterParticipant(req: Request, res: Response) {
|
|||
privacyPolicyLink:
|
||||
process.env.NEWSLETTER_PRIVACY_POLICY_URLS?.split(",")[0],
|
||||
});
|
||||
|
||||
telegramNotification(
|
||||
1,
|
||||
`New newsletter participant: ${email}, type: ${type}`
|
||||
);
|
||||
} else {
|
||||
newsletterLogger.warn(
|
||||
`AddNewsletterParticipant: email: ${email} already in newsletter of type: ${type}`
|
||||
|
@ -112,6 +118,11 @@ export async function ConfirmNewsletterParticipation(
|
|||
newsletterLogger.info(
|
||||
`ConfirmNewsletterParticipation newsletterId: ${newsletterId} email: ${newsletterParticipant.email} confirmed`
|
||||
);
|
||||
|
||||
telegramNotification(
|
||||
1,
|
||||
`Newsletter participant confirmed: ${newsletterParticipant.email}, type: ${newsletterParticipant.type}`
|
||||
);
|
||||
} else {
|
||||
newsletterLogger.warn(
|
||||
`ConfirmNewsletterParticipation: newsletter id: ${newsletterId} email: ${newsletterParticipant.email} already confirmed`
|
||||
|
@ -158,6 +169,11 @@ export async function RemoveNewsletterParticipant(req: Request, res: Response) {
|
|||
`RemoveNewsletterParticipant newsletterId: ${newsletterId} removed. Email: ${newsletterParticipant.email}, type: ${newsletterParticipant.type}, state: ${newsletterParticipant.state}`
|
||||
);
|
||||
|
||||
telegramNotification(
|
||||
1,
|
||||
`Newsletter participant removed: ${newsletterParticipant.email}, type: ${newsletterParticipant.type}`
|
||||
);
|
||||
|
||||
return res.status(200).send({ status: "success" });
|
||||
} catch (error) {
|
||||
newsletterLogger.error("RemoveNewsletterParticipant err:", error as string);
|
||||
|
|
Loading…
Reference in New Issue