fix: resolve MongoDB connection and port configuration issues
- Added dotenv configuration for environment variables - Fixed MongoDB connection string loading - Configured server port to 3005 - Updated cron jobs for expired messages
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
const OTP_VALID_MS = 3 * 60 * 1000
|
||||
|
||||
const isOtpExpired = (user) => {
|
||||
if (!user?.otp) return true
|
||||
if (!user?.otpSentAt) return false
|
||||
return Date.now() - new Date(user.otpSentAt).getTime() > OTP_VALID_MS
|
||||
}
|
||||
|
||||
const clearOtp = (UserModel, mobile) =>
|
||||
UserModel.updateOne({ mobile }, { $set: { otp: null, otpSentAt: null } })
|
||||
|
||||
module.exports = {
|
||||
OTP_VALID_MS,
|
||||
isOtpExpired,
|
||||
clearOtp
|
||||
}
|
||||
const OTP_VALID_MS = 3 * 60 * 1000
|
||||
|
||||
const isOtpExpired = (user) => {
|
||||
if (!user?.otp) return true
|
||||
if (!user?.otpSentAt) return false
|
||||
return Date.now() - new Date(user.otpSentAt).getTime() > OTP_VALID_MS
|
||||
}
|
||||
|
||||
const clearOtp = (UserModel, mobile) =>
|
||||
UserModel.updateOne({ mobile }, { $set: { otp: null, otpSentAt: null } })
|
||||
|
||||
module.exports = {
|
||||
OTP_VALID_MS,
|
||||
isOtpExpired,
|
||||
clearOtp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user