Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
4.2 kB
1
Indexable
Never
const mongoose = require("mongoose");
const { isEmail } = require("validator");
const bcrypt = require("bcrypt");

const studentSchema = new mongoose.Schema({
    // TE roll number
    rollNumber :{
        type:Number,
        required:true,
        unique:true,
        maxlength:5     
    },
    teSection :{
        type:String,
        required:true
    },
    firstName:{
        type:String,
        required:true
    },
    
    middleName:{
        type:String,
        required:true
    },
    lastName:{
        type:String,
        required:true
    },
    
    primaryEmail:{
        type:String,
        required:true,
        unique:true,
        validate:[isEmail,"Please Enter a Valid Email"]
    },
    alternateEmail:{
        type:String,
        required:true,
        unique:true,
        validate:[isEmail,"Please Enter a Valid Email"]
    },
    
    primaryPhone:{
        type:Number,
        required:true,
        unique:true
    },
    alternatePhone:{
        type:Number,       
    },
    dob:{
        type:Date,
        unique:true
    },
    gender:{
        type:String,
        required:true
    },
    currentAddress:{
        type:String,
        required:true
    },
    permanentAddress:{
        type:String,
        required:true
    },
    branch: {
        type:String,
        required:true
    },
    // collage registrayion number
    pictRegistrationId: {
        type:String,
        required:true,
        tolower:true
    },
    // university Permanent Registration number
    PRN: {
        type:String,
        required:true,
        uppercase :true
    },
    // SSC details

    // percentage
    SSC:{
        type:Number,  
        min:0,
        max:100     
    },
    sscBoard :{
        type:String,
        required:true,
        uppercase :true
    },
    yearOFPassingSsc :{
        type:Date,
        required:true 
    },
    gapAfterSsc :{
        type:String,
    },
    reasonOfGapSsc :{
        type:String,
    },
    // HSC details

    // what if student had diploma not hsc ?

    // percentage in 12th
    HSC:{
        type:Number,  
        min:0,
        max:100     
    },

    hscBoard :{
        type:String,
        required:true,
        uppercase :true
    },
    yearOFPassingHsc :{
        type:Date,
        required:true 
    },
    gapAfterHsc :{
        type:String,
    },
    reasonOfGapHsc :{
        type:String,
    },
    // Diploma details

    // percentage
    diploma:{
        type:Number,
    },
    universityOfDiploma :{
        type:String
    },
    yearOfPassingOfDipoma :{
        type:Date,
    },
    gapAfterDiploma :{
        type:Number,
    },
    reasonForGapDiploma :{
        type:String,
    },

    // collage  details 

    yearOfStartingCollgae :{
        type:Date,
    },
    firstYearFirstSemCgpa :{
        type:Number,
        max :10,
    },
    firstYearSecondSemCgpa :{
        type:Number,
        max :10,
    },
    secondYearfirstSemCgpa :{
        type:Number,
        max:10
    },
    secondYearSecondSemCgpa:{
        type:Number,
        max:10
    },
    thirdYearFirstSemCgpa :{
        type:Number,
        max:10
    },

    activeBacklog :{
        type:Number,
        required:true
    },
    passiveBacklog :{
        type:Number,
        required:true
    },
    //  candidate a year down
    areYouYD :{
        type:String,
        required:true
    },
    // aadhar card details
    aadharCard :{
        type:Number,
        // required:true                          commented 
    },
    // panCard 
    panCard :{
        type:String,
        required:true
    },
    passPortNumber :{
        type:String,
    },
    citizenship :{
        type:String,
        required:true,
    },
    PlanningForHigherEducation :{
        type:String,
        required:true,
    },
    // Amcat details
    appearedForAmcat:{
        type:String,
        required:true,
    }

    
});


const Student = mongoose.model('Student', studentSchema);

module.exports = Student;