From c760d67baf9e008c2ed0cc184ce3a80122e009ab Mon Sep 17 00:00:00 2001 From: Seokyeong Date: Thu, 28 Sep 2023 18:16:24 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EA=B0=99=EC=9D=80=20=EC=86=8C=EC=85=9C?= =?UTF-8?q?,=20=EB=8B=A4=EB=A5=B8=20=EA=B8=B0=EA=B8=B0=EB=A1=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=8B=9C=20=EC=83=88=EB=A1=9C?= =?UTF-8?q?=EC=9A=B4=20=EA=B8=B0=EA=B8=B0=EB=A1=9C=20=ED=91=B8=EC=8B=9C?= =?UTF-8?q?=EC=95=8C=EB=A6=BC=20=EB=A6=AC=EC=8A=A4=EC=BC=80=EC=A4=84?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/AuthService.ts | 90 +++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/src/services/AuthService.ts b/src/services/AuthService.ts index c653157..fb75a4d 100644 --- a/src/services/AuthService.ts +++ b/src/services/AuthService.ts @@ -6,6 +6,8 @@ import { AuthResponseDto } from "../interfaces/auth/AuthResponseDto"; import { AuthLogoutDto } from "../interfaces/auth/AuthLogoutDto"; import exceptionMessage from "../modules/exceptionMessage"; import agenda from "../loaders/agenda"; +import pushMessage from "../modules/pushMessage"; +import * as admin from "firebase-admin"; const kakaoLogin = async (kakaoToken: string, fcmToken: string): Promise => { try { @@ -77,6 +79,50 @@ const kakaoLogin = async (kakaoToken: string, fcmToken: string): Promise { + admin + .messaging() + .sendMulticast(alarms) + .then(function (res: any) { + console.log("Sent message result: ", res); + }); + job.repeatEvery("24 hours").save(); + done(); + }); + agenda.start(); + + await agenda.cancel({ "data.userId": existUser._id }); + + agenda.schedule("today at " + pushTime + ampm + "", "push_" + `${existUser._id}`, { userId: existUser._id }); + } + return data; } catch (err) { console.log(err); @@ -154,6 +200,50 @@ const appleLogin = async (appleToken: string, fcmToken: string): Promise { + admin + .messaging() + .sendMulticast(alarms) + .then(function (res: any) { + console.log("Sent message result: ", res); + }); + job.repeatEvery("24 hours").save(); + done(); + }); + agenda.start(); + + await agenda.cancel({ "data.userId": existUser._id }); + + agenda.schedule("today at " + pushTime + ampm + "", "push_" + `${existUser._id}`, { userId: existUser._id }); + } + return data; } catch (err) { console.log(err);