From 692114878a3109419b175a16b5439550517a1468 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 27 Mar 2024 18:59:58 +0100 Subject: [PATCH] user and log --- src/controllers/userController.ts | 2 +- src/utils/adminDashboard.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/controllers/userController.ts b/src/controllers/userController.ts index 17d86da..6ad10ae 100644 --- a/src/controllers/userController.ts +++ b/src/controllers/userController.ts @@ -347,7 +347,7 @@ export async function Login(req: Request, res: Response) { telegramNotification( 1, - `User logged in: user_id: ${user.user_id} email: ${email} language: ${user.language}` + `User logged in: user_id: ${user.user_id} email: ${email}` ); } catch (error) { logger.error("login error", error as string); diff --git a/src/utils/adminDashboard.ts b/src/utils/adminDashboard.ts index 01bae47..02dc06a 100644 --- a/src/utils/adminDashboard.ts +++ b/src/utils/adminDashboard.ts @@ -11,12 +11,23 @@ export async function telegramNotification( axios({ url: `${process.env.ADMIN_DASHBOARD_TELEGRAM_NOTIFICATIONS_URL}`, method: "post", + headers: { + "Content-Type": "application/json", + "X-Api-Key": process.env.ADMIN_DASHBOARD_TELEGRAM_NOTIFICATIONS_API_KEY, + }, data: { type: type, title: message, - userIds: userIds || [], + userIds: userIds || [ + "d2705d63-8668-4517-8b8b-e5396fb7e80b", // alex + "61660369-3ac9-4365-ab35-e96d58cdba2a", // jan + ], }, - }).catch((error) => { - logger.error("Telegram notification error:", error); - }); + }) + .then((response) => { + logger.info("Telegram notification response:", response.data); + }) + .catch((error) => { + logger.error("Telegram notification error:", error); + }); }