Skip to content

Commit

Permalink
Merge pull request #3 from HelloSniperMonkey/main
Browse files Browse the repository at this point in the history
made necessary changes while resolving merge conflicts
  • Loading branch information
kushalag02 authored Dec 20, 2024
2 parents dd71791 + 13f5a77 commit 1decc09
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
package-lock.json
13 changes: 11 additions & 2 deletions models/Mentor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ const mentorSchema = new Schema({
required: true,
unique: true,
},
gitlabProfile: {
type: String,
required: false,
unique: true,
},
otherProfile: {
type: String,
required: true,
required: false,
unique: true,
},
projectList: {
type: Array<String>,

Check failure on line 42 in models/Mentor.ts

View workflow job for this annotation

GitHub Actions / Lint code base

Don't use `String` as a type. Use string instead
required: true,
},
willReview: {
type: Boolean,
type: String,
required: true,
},
firstTime: {
Expand Down
17 changes: 11 additions & 6 deletions models/Student.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,40 @@ const studentSchema = new Schema({
},
lastname: {
type: String,
required: true,
required: false,
},
email: {
type: String,
required: true,
unique: true,
},
instituteEmail: {
institute: {
type: String,
required: true,
unique: true,
},
phoneno: {
type: String,
required: true,
unique: true,
},
organization: {
profilePage: {
type: String,
required: true,
required: false,
unique: true,
},
githubProfile: {
type: String,
required: true,
unique: true,
},
gitlabProfile: {
type: String,
required: false,
unique: true,
},
otherProfile: {
type: String,
required: true,
required: false,
unique: true,
},
firstTime: {
Expand Down
46 changes: 32 additions & 14 deletions src/routes/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@ import { body, validationResult } from 'express-validator'
// @return JSON object
router.post(
'/student',
body('firstname').isLength({ min: 1 }).withMessage('First Name is required'),
body('lastname').isLength({ min: 1 }).withMessage('Last Name is required'),
body('firstname').isLength({ min: 1 }).withMessage('Name is required'),
body('firstname').trim().isAlpha().withMessage('First name must contain only letters'),
body('lastname').trim().isAlpha().withMessage('Last name must contain only letters'),
body('email').isLength({ min: 1 }).withMessage('Email is required'),
body('instituteEmail').isLength({ min: 1 }).withMessage('Institute Email is required'),
body('institute').isLength({ min: 1 }).withMessage('Institute is required'),
body('email').isEmail().normalizeEmail().withMessage('Invalid email format'),
body('phoneno').isLength({ min: 1 }).withMessage('Phone Number is required'),
body('organization').isLength({ min: 1 }).withMessage('Organization is required'),
body('phoneno')
.matches(/^[0-9]{10}$/)
.withMessage('Phone number must be 10 digits'),
body('githubProfile').isLength({ min: 1 }).withMessage('Github Profile is required'),
body('otherProfile').isLength({ min: 1 }).withMessage('Other Profile is required'),
body('firstTime').isLength({ min: 1 }).withMessage('First Time is required'),
async (
req: {
body: {
firstname: any
lastname: any
email: any
instituteEmail: any
phoneno: any
organization: any
institute: any
phoneno: number
profilePage: any
gitlabProfile: any
githubProfile: any
otherProfile: any
firstTime: any
Expand All @@ -53,9 +57,10 @@ router.post(
firstname,
lastname,
email,
instituteEmail,
institute,
phoneno,
organization,
profilePage,
gitlabProfile,
githubProfile,
otherProfile,
firstTime,
Expand All @@ -64,9 +69,10 @@ router.post(
firstname,
lastname,
email,
instituteEmail,
institute,
phoneno,
organization,
profilePage,
gitlabProfile,
githubProfile,
otherProfile,
firstTime,
Expand All @@ -87,12 +93,18 @@ router.post(
router.post(
'/mentor',
body('firstname').isLength({ min: 1 }).withMessage('Name is required'),
body('lastname').isLength({ min: 1 }).withMessage('Email is required'),
body('firstname').trim().isAlpha().withMessage('First name must contain only letters'),
body('lastname').trim().isAlpha().withMessage('Last name must contain only letters'),
body('email').isLength({ min: 1 }).withMessage('Email is required'),
body('email').isEmail().normalizeEmail().withMessage('Invalid email format'),
body('phoneno').isLength({ min: 1 }).withMessage('Phone Number is required'),
body('phoneno')
.matches(/^[0-9]{10}$/)
.withMessage('Phone number must be 10 digits'),
body('organization').isLength({ min: 1 }).withMessage('Organization is required'),
body('githubProfile').isLength({ min: 1 }).withMessage('Github Profile is required'),
body('otherProfile').isLength({ min: 1 }).withMessage('Other Profile is required'),
body('projectList').isLength({ min: 1 }).withMessage('Project List is required'),
body('firstTime').isLength({ min: 1 }).withMessage('First Time is required'),
body('willReview').isLength({ min: 1 }).withMessage('Will Review is required'),
async (
Expand All @@ -101,10 +113,12 @@ router.post(
firstname: any
lastname: any
email: any
phoneno: any
phoneno: number
organization: any
githubProfile: any
gitlabProfile: any
otherProfile: any
projectList: Array<any>
firstTime: any
willReview: any
}
Expand All @@ -130,7 +144,9 @@ router.post(
phoneno,
organization,
githubProfile,
gitlabProfile,
otherProfile,
projectList,
firstTime,
willReview,
} = req.body
Expand All @@ -141,7 +157,9 @@ router.post(
phoneno,
organization,
githubProfile,
gitlabProfile,
otherProfile,
projectList,
firstTime,
willReview,
})
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down

0 comments on commit 1decc09

Please sign in to comment.