user and log

main
alex 2024-03-27 18:59:58 +01:00
parent 09ee0a9654
commit 692114878a
2 changed files with 16 additions and 5 deletions

View File

@ -347,7 +347,7 @@ export async function Login(req: Request, res: Response) {
telegramNotification( telegramNotification(
1, 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) { } catch (error) {
logger.error("login error", error as string); logger.error("login error", error as string);

View File

@ -11,12 +11,23 @@ export async function telegramNotification(
axios({ axios({
url: `${process.env.ADMIN_DASHBOARD_TELEGRAM_NOTIFICATIONS_URL}`, url: `${process.env.ADMIN_DASHBOARD_TELEGRAM_NOTIFICATIONS_URL}`,
method: "post", method: "post",
headers: {
"Content-Type": "application/json",
"X-Api-Key": process.env.ADMIN_DASHBOARD_TELEGRAM_NOTIFICATIONS_API_KEY,
},
data: { data: {
type: type, type: type,
title: message, title: message,
userIds: userIds || [], userIds: userIds || [
"d2705d63-8668-4517-8b8b-e5396fb7e80b", // alex
"61660369-3ac9-4365-ab35-e96d58cdba2a", // jan
],
}, },
}).catch((error) => { })
.then((response) => {
logger.info("Telegram notification response:", response.data);
})
.catch((error) => {
logger.error("Telegram notification error:", error); logger.error("Telegram notification error:", error);
}); });
} }