Showing
1 changed file
with
18 additions
and
15 deletions
| ... | @@ -7,17 +7,17 @@ | ... | @@ -7,17 +7,17 @@ |
| 7 | * 2) Dosage에 따라, Push Notification 발송 | 7 | * 2) Dosage에 따라, Push Notification 발송 |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -const cron = require('node-cron'); | 10 | + const cron = require('node-cron'); |
| 11 | 11 | ||
| 12 | -const Profile = require('../models/profile'); | 12 | + const Profile = require('../models/profile'); |
| 13 | -const User = require('../models/user'); | 13 | + const User = require('../models/user'); |
| 14 | -const Hub = require('../models/hub'); | 14 | + const Hub = require('../models/hub'); |
| 15 | -const Bottle = require('../models/bottle'); | 15 | + const Bottle = require('../models/bottle'); |
| 16 | -const BottleMedicine = require('../models/bottleMedicine'); | 16 | + const BottleMedicine = require('../models/bottleMedicine'); |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | -//매년 1월 1일 00시 00분에 1살씩 추가 | 19 | + //매년 1월 1일 00시 00분에 1살씩 추가 |
| 20 | -exports.CheckNewYear = () => { | 20 | + exports.CheckNewYear = () => { |
| 21 | cron.schedule('0 0 0 1 1 *', async () => { | 21 | cron.schedule('0 0 0 1 1 *', async () => { |
| 22 | const profileList = await Profile.find(); | 22 | const profileList = await Profile.find(); |
| 23 | profileList.forEach(async profile => { | 23 | profileList.forEach(async profile => { |
| ... | @@ -28,11 +28,11 @@ exports.CheckNewYear = () => { | ... | @@ -28,11 +28,11 @@ exports.CheckNewYear = () => { |
| 28 | }, { | 28 | }, { |
| 29 | timezone : 'Asia/Tokyo', | 29 | timezone : 'Asia/Tokyo', |
| 30 | }); | 30 | }); |
| 31 | -}; | 31 | + }; |
| 32 | 32 | ||
| 33 | -//dosage에 따라, Push Notification을 발송한다. | 33 | + //dosage에 따라, Push Notification을 발송한다. |
| 34 | -//아침 8시, 점심 12시, 저녁 6시에 한번씩 발송 | 34 | + //아침 8시, 점심 12시, 저녁 6시에 한번씩 발송 |
| 35 | -exports.PushNotifyByDosage = async() => { | 35 | + exports.PushNotifyByDosage = async() => { |
| 36 | 36 | ||
| 37 | //매일 아침 8시 : 복용량 상관 없이 보냄 | 37 | //매일 아침 8시 : 복용량 상관 없이 보냄 |
| 38 | cron.schedule('0 0 8 * * *', async () => { | 38 | cron.schedule('0 0 8 * * *', async () => { |
| ... | @@ -93,9 +93,12 @@ exports.PushNotifyByDosage = async() => { | ... | @@ -93,9 +93,12 @@ exports.PushNotifyByDosage = async() => { |
| 93 | timezone : 'Asia/Tokyo', | 93 | timezone : 'Asia/Tokyo', |
| 94 | }); | 94 | }); |
| 95 | 95 | ||
| 96 | -}; | 96 | + }; |
| 97 | 97 | ||
| 98 | -const PushNotify = async(deviceToken) => { | 98 | + const PushNotify = async(deviceToken) => { |
| 99 | //toDo : deviceToken을 받아서 push notification을 발송하는 함수 | 99 | //toDo : deviceToken을 받아서 push notification을 발송하는 함수 |
| 100 | + if(deviceToken) { | ||
| 100 | console.log(deviceToken); | 101 | console.log(deviceToken); |
| 101 | -}; | 102 | + } |
| 103 | + }; | ||
| 104 | + | ... | ... |
-
Please register or login to post a comment