Notif system
This commit is contained in:
@@ -7,6 +7,8 @@ const { checkValidations } = require('../plugins/controllersHelperFunctions')
|
||||
const UserGPS = require('../models/GPS.User')
|
||||
const { generateRandomDigits
|
||||
} = require('../plugins/controllersHelperFunctions')
|
||||
const Notification = require('../models/GPS.Notif')
|
||||
|
||||
module.exports.login_with_pass = [
|
||||
[
|
||||
body('username')
|
||||
@@ -55,6 +57,10 @@ module.exports.login_with_pass = [
|
||||
})
|
||||
user.token = token
|
||||
await user.save()
|
||||
await Notification.create({
|
||||
userID:user._id,
|
||||
content:"test"
|
||||
})
|
||||
return res.status(200).json({ token })
|
||||
} catch (err) {
|
||||
return res.status(422).json({
|
||||
@@ -90,6 +96,10 @@ module.exports.login_with_otp = [
|
||||
})
|
||||
user.otp = generateRandomDigits(6)
|
||||
user.save()
|
||||
await Notification.create({
|
||||
userID:user._id,
|
||||
content:"test"
|
||||
})
|
||||
return res.status(200).json({ token })
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user