feat: sms module
This commit is contained in:
@@ -14,17 +14,11 @@ const {
|
||||
checkMobileNumber,
|
||||
normalizeMobileNumber
|
||||
} = require('../plugins/controllersHelperFunctions')
|
||||
const { SMS } = require('../plugins/SMS_Module')
|
||||
const { phrases } = require('../plugins/SMS_Phrases')
|
||||
const sms = require('../plugins/SMS_Module')
|
||||
|
||||
///
|
||||
const _faSr = _sr.fa
|
||||
|
||||
// date formaters
|
||||
function SmsDateFormat(date) {
|
||||
return moment(date).format('jYYYY/jMM/jDD')
|
||||
}
|
||||
|
||||
module.exports.addLottery = [
|
||||
[
|
||||
body('title').notEmpty().withMessage(_faSr.required.title),
|
||||
@@ -338,18 +332,7 @@ module.exports.enrollParticipant = [
|
||||
lottery.markModified('participants')
|
||||
await lottery.save()
|
||||
|
||||
const msg = [
|
||||
fullName,
|
||||
' عزیز، اطلاعات شما در تاریخ ',
|
||||
SmsDateFormat(Date.now()),
|
||||
' برای شرکت در قرعه کشی آسان سرویس ثبت گردید. ',
|
||||
'\n',
|
||||
'کد پیگیری: ',
|
||||
enrollCode,
|
||||
'\n',
|
||||
phrases.signature
|
||||
]
|
||||
SMS([normalizedMN], msg.join(''))
|
||||
await sms.lottery.enrollment(normalizedMN, fullName, enrollCode, Date.now())
|
||||
return res.json({ message: 'اطلاعات شما با موفیقت در سیستم ثبت شد. کد پیگیری به تلفن همراه شما ارسال گردید' })
|
||||
} catch (e) {
|
||||
return res500(res, `there is an error here --- ${e}`)
|
||||
|
||||
Reference in New Issue
Block a user