-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.js
More file actions
22 lines (20 loc) · 750 Bytes
/
user.js
File metadata and controls
22 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const mongoose = require('mongoose');
const userSchema = mongoose.Schema({
_id: { type: mongoose.Schema.Types.ObjectId, auto: true },
emailProcessed: {
type: String,
required: true,
match: /^[a-z0-9.]+@[a-z0-9]+\.[a-z0-9]{2,}$/i
},
emailFront: {
type: String,
required: true,
match: /^[a-z0-9.]+(:?\+[a-z0-9.+]+)?@[a-z0-9]+\.[a-z0-9]{2,}$/i
},
password: { type: String, required: true },
verified: { type: Boolean, default: false },
registrationDate: { type: Date, default: Date.now },
enableEmailNotifications: { type: Boolean, default: true },
allowAttachmentsInEmail: { type: Boolean, default: true }
});
module.exports = mongoose.model('User', userSchema);