UNPKG

flexbiz-server

Version:

Flexible Server

2 lines (1 loc) 491 B
'use strict';const otpSchema=new Schema({phone:{type:String,required:!0,maxlength:128,trim:!0},otp:{type:String,required:!0,maxlength:32,trim:!0},expire_time:{type:Date},verified:Boolean,tried_number:Number,date_created:{type:Date,default:Date.now}});(global.configs||{}).createIndexes&&(otpSchema.index({otp:1}),otpSchema.index({phone:1}),otpSchema.index({phone:"text"}),otpSchema.index({date_created:-1}));const otp=mongoose.models.otp||mongoose.model("otp",otpSchema);module.exports=otp;