diff --git a/models/Student.ts b/models/Student.ts index 7a64d96..8aca343 100644 --- a/models/Student.ts +++ b/models/Student.ts @@ -22,6 +22,11 @@ const studentSchema = new Schema({ type: String, required: true, }, + instituteEmail: { + type: String, + required: true, + unique: true, + }, phoneno: { type: String, required: true, diff --git a/src/routes/register.ts b/src/routes/register.ts index 85fd78f..500a095 100644 --- a/src/routes/register.ts +++ b/src/routes/register.ts @@ -36,7 +36,7 @@ router.post( email: any password: any institute: any - instituteEmail: any | undefined + instituteEmail: any phoneno: number profilePage: any gitlabProfile: any @@ -62,6 +62,7 @@ router.post( email, password, institute, + instituteEmail, phoneno, profilePage, gitlabProfile, @@ -76,6 +77,7 @@ router.post( email, password: password_hash, institute, + instituteEmail, phoneno, profilePage, gitlabProfile, @@ -83,9 +85,6 @@ router.post( otherProfile, firstTime, } - if (req.body.instituteEmail !== undefined) { - student.instituteEmail = req.body.instituteEmail - } let user = new Student(student) const token = generateToken({ email: email }) console.log(token)