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: { text: {
type: String, required: [true, "can't be blank"], type: String, required: [true, "can't be blank"],
}, },
user: {
type: Schema.Types.ObjectId, ref: 'User',
},
}, { timestamps: true }); }, { timestamps: true });
module.exports = NoteSchema; module.exports = NoteSchema;

View File

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