Email field

pull/1/head
sundowndev 2018-11-15 19:26:57 +01:00
parent c98c3d0e44
commit 4cb06a5324
2 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,9 @@ const NoteSchema = new Schema({
text: {
type: String, required: [true, "can't be blank"],
},
user: {
type: Schema.Types.ObjectId, ref: 'User',
},
}, { timestamps: true });
module.exports = NoteSchema;

View File

@ -9,8 +9,8 @@ const UserSchema = new Schema({
lastname: {
type: String, required: [true, "can't be blank"],
},
username: {
type: String, lowercase: true, unique: true, required: [true, "can't be blank"], match: [/^[a-zA-Z0-9]+$/, 'is invalid'], index: true,
email: {
type: String, lowercase: true, unique: true, required: [true, "can't be blank"], index: true,
},
password: {
type: String, required: [true, "can't be blank"],