Showing
4 changed files
with
17 additions
and
23 deletions
... | @@ -38,6 +38,5 @@ app.use(router.routes()).use(router.allowedMethods()); | ... | @@ -38,6 +38,5 @@ app.use(router.routes()).use(router.allowedMethods()); |
38 | app.listen(SERVER_PORT, () => { | 38 | app.listen(SERVER_PORT, () => { |
39 | console.log('\x1b[1;36mPORT : ', SERVER_PORT, 'is connected\x1b[0m'); | 39 | console.log('\x1b[1;36mPORT : ', SERVER_PORT, 'is connected\x1b[0m'); |
40 | MqttServer.on(); | 40 | MqttServer.on(); |
41 | - BatchSystem.CheckNewYear(); | ||
42 | BatchSystem.PushNotifyByDosage(); | 41 | BatchSystem.PushNotifyByDosage(); |
43 | }); | 42 | }); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -13,7 +13,7 @@ exports.register = async(ctx) => { | ... | @@ -13,7 +13,7 @@ exports.register = async(ctx) => { |
13 | password, | 13 | password, |
14 | passwordCheck, | 14 | passwordCheck, |
15 | userNm, | 15 | userNm, |
16 | - userAge, | 16 | + birth, |
17 | contact, | 17 | contact, |
18 | } = ctx.request.body; | 18 | } = ctx.request.body; |
19 | 19 | ||
... | @@ -22,7 +22,7 @@ exports.register = async(ctx) => { | ... | @@ -22,7 +22,7 @@ exports.register = async(ctx) => { |
22 | password : Joi.string().required(), | 22 | password : Joi.string().required(), |
23 | passwordCheck : Joi.string().required(), | 23 | passwordCheck : Joi.string().required(), |
24 | userNm : Joi.string().required(), | 24 | userNm : Joi.string().required(), |
25 | - userAge : Joi.number().required(), | 25 | + birth : Joi.string().required(), |
26 | contact : Joi.string().required(), | 26 | contact : Joi.string().required(), |
27 | }); | 27 | }); |
28 | 28 | ||
... | @@ -55,7 +55,7 @@ exports.register = async(ctx) => { | ... | @@ -55,7 +55,7 @@ exports.register = async(ctx) => { |
55 | const profile = new Profile({ | 55 | const profile = new Profile({ |
56 | userId, | 56 | userId, |
57 | userNm, | 57 | userNm, |
58 | - userAge, | 58 | + birth, |
59 | contact, | 59 | contact, |
60 | }); | 60 | }); |
61 | 61 | ... | ... |
... | @@ -5,7 +5,7 @@ const Schema = mongoose.Schema; | ... | @@ -5,7 +5,7 @@ const Schema = mongoose.Schema; |
5 | const ProfileSchema = new Schema({ | 5 | const ProfileSchema = new Schema({ |
6 | userId : { type : String, required : true, ref : 'User', }, | 6 | userId : { type : String, required : true, ref : 'User', }, |
7 | userNm : { type : String, required : true, }, | 7 | userNm : { type : String, required : true, }, |
8 | - userAge : { type : Number, required : true, }, | 8 | + birth : { type : String, required : true, }, |
9 | contact : { type : String, required : true, }, | 9 | contact : { type : String, required : true, }, |
10 | deviceToken : { type : String, default : null, }, | 10 | deviceToken : { type : String, default : null, }, |
11 | }); | 11 | }); |
... | @@ -18,10 +18,6 @@ ProfileSchema.methods.updateUserContact = function(contact) { | ... | @@ -18,10 +18,6 @@ ProfileSchema.methods.updateUserContact = function(contact) { |
18 | this.contact = contact; | 18 | this.contact = contact; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | -ProfileSchema.methods.updateUserAge = function() { | ||
22 | - this.userAge = this.userAge + 1; | ||
23 | -}; | ||
24 | - | ||
25 | ProfileSchema.methods.updateDeviceToken = function(deviceToken) { | 21 | ProfileSchema.methods.updateDeviceToken = function(deviceToken) { |
26 | this.deviceToken = deviceToken; | 22 | this.deviceToken = deviceToken; |
27 | }; | 23 | }; | ... | ... |
... | @@ -3,8 +3,7 @@ | ... | @@ -3,8 +3,7 @@ |
3 | * 21/09/14 | 3 | * 21/09/14 |
4 | * Author : 박권수 | 4 | * Author : 박권수 |
5 | * 배치 시스템 | 5 | * 배치 시스템 |
6 | - * 1) 매년 지나면 프로필의 Age를 +1 | 6 | + * 1) Dosage에 따라, Push Notification 발송 |
7 | - * 2) Dosage에 따라, Push Notification 발송 | ||
8 | */ | 7 | */ |
9 | 8 | ||
10 | const cron = require('node-cron'); | 9 | const cron = require('node-cron'); |
... | @@ -16,19 +15,19 @@ | ... | @@ -16,19 +15,19 @@ |
16 | const BottleMedicine = require('../models/bottleMedicine'); | 15 | const BottleMedicine = require('../models/bottleMedicine'); |
17 | 16 | ||
18 | 17 | ||
19 | - //매년 1월 1일 00시 00분에 1살씩 추가 | 18 | +// //매년 1월 1일 00시 00분에 1살씩 추가 |
20 | - exports.CheckNewYear = () => { | 19 | +// exports.CheckNewYear = () => { |
21 | - cron.schedule('0 0 0 1 1 *', async () => { | 20 | +// cron.schedule('0 0 0 1 1 *', async () => { |
22 | - const profileList = await Profile.find(); | 21 | +// const profileList = await Profile.find(); |
23 | - profileList.forEach(async profile => { | 22 | +// profileList.forEach(async profile => { |
24 | - await profile.updateUserAge(); | 23 | +// await profile.updateUserAge(); |
25 | - profile.save(); | 24 | +// profile.save(); |
26 | - }); | 25 | +// }); |
27 | 26 | ||
28 | - }, { | 27 | +// }, { |
29 | - timezone : 'Asia/Tokyo', | 28 | +// timezone : 'Asia/Tokyo', |
30 | - }); | 29 | +// }); |
31 | - }; | 30 | +// }; |
32 | 31 | ||
33 | //dosage에 따라, Push Notification을 발송한다. | 32 | //dosage에 따라, Push Notification을 발송한다. |
34 | //아침 8시, 점심 12시, 저녁 6시에 한번씩 발송 | 33 | //아침 8시, 점심 12시, 저녁 6시에 한번씩 발송 | ... | ... |
-
Please register or login to post a comment