-
Notifications
You must be signed in to change notification settings - Fork 5
/
model.js
40 lines (36 loc) · 1.3 KB
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { Schema, model } = require('mongoose')
const TrackingSchema = new Schema({
pincode: { type: Number },
age_group: { type: Number },
dose: { type: Number, default: 0 }
}, {
id: true,
})
const UserSchema = new Schema({
chatId: { type: Number, required: true },
allowed: { type: Boolean, default: false },
mobile: { type: String },
lastOtpRequested: { type: Number },
snoozeTime: { type: Number },
snoozedAt: { type: Number },
txnId: { type: String, default: null },
token: { type: String, default: null },
stateId: { type: Number },
districtId: { type: Number },
tmpPincode: { type: Number },
tmp_age_group: { type: Number },
tmpDose: { type: Number },
tracking: [{ type: TrackingSchema, default: [] }],
beneficiaries: { type: Array, default: [] },
preferredBenef: { type: Object, default: null },
autobook: { type: Boolean, default: false },
vaccine: { type: String, default: 'ANY' },
otpCount: { type: Number, default: 0 },
feeType: { type: String, default: 'ANY' },
centers: [{ type: Number, default: [] }],
walkthrough: { type: Boolean, default: false },
expireCount: { type: Number, default: 0 },
appOtp: { type: Number, default: null }
})
const User = model('User', UserSchema, 'users')
module.exports = User