Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

200-Addressed-461-Use-of-Session-and-Transaction-to-maintain-acid-edi… #463

Conversation

Vikrantsingh22
Copy link
Member

Addressed: #461
[Feature/Enhancement] MongoDB Transaction and Session Based Student Creation

Pull Request Message:

  • implemented MongoDB sessions to manage transactions, ensuring atomicity during the creation of student details.

  • Made sure that when POST request is made to the /student/create/ route, it is mandatory to include all necessary
    variables in the JSON input.

  • The creation of documents in the student, stdEduHistory , stdMedHistory , stdBank , and stdPersonal models is now
    part of a transaction. If any document creation fails, the entire transaction will be aborted.

  • Updated student.test.js the to align with the new POST method for student creation, ensuring comprehensive coverage.

SAMPLE JSON to make POST request

    "ERPID": "ST14556245",
    "name": "John",
    "joiningYear": 2022,
    "branch": "6578042cce48f3f5c4bca35b",
    "division": "B",
    "rollNo": 101,
    "coursesOpted": [
        "6578042dce48f3f5c4bcd9bc"
    ],
    "uid": "USR25123456445",
    "bankName": "Example Bank",
    "bankAccount": "001234567890",
    "bankBranch": "Main Branch",
    "bankIfsc": "ABCD0123456",
    "bankMicr": "012345678",
    "admissionYear": "2022",
    "studentCode": "SC123",
    "admissionStatus": "Admitted",
    "admissionPattern": "Regular",
    "admissionCategory": "General",
    "seatDesc": "Engineering",
    "quotaType": "Government",
    "isBoarderStudent": true,
    "seatType": "Regular",
    "seatSubType": "Computer Science",
    "eligibilityNo": "EL12345",
    "enrollmentNo": "EN123456",
    "marks": "500",
    "percentage": 80.5,
    "seatNumber": "S123",
    "examName": "SSC",
    "examBoard": "State Board",
    "msOms": "OMS123",
    "meritNumberInQualifyingExam": "M123",
    "admittedNumber": "A123",
    "cetRollNo": "CET123",
    "cetMarks": "120",
    "qualifyingExamForAdmission": "HSC",
    "stdType": "Science",
    "streamOpted": "Engineering",
    "mediumOfInstruction": "English",
    "aggTotalMarks": 450,
    "totalMarksOutOf": 500,
    "percentOfMarks": "90%",
    "attemptNo": "1",
    "passingMonth": "May",
    "passingYear": "2022",
    "institutionName": "XYZ School",
    "educBoardName": "State Board",
    "pcmPercent": "85%",
    "pbmPercent": "88%",
    "stuQualifyingExam": "HSC",
    "marksObtained": "450",
    "stateRank": "10",
    "prevExamSeatNumber": "PREV123",
    "prevTcNumber": "TC123",
    "hscPassedSchoolName": "ABC College",
    "boardPattern": "State Board",
    "scholarshipName": "Merit Scholarship",
    "scholarshipType": "Merit",
    "dteSeatType": "Government",
    "dteUserPassword": "password123",
    "dteUserId": "user123",
    "graduationInstitute": "XYZ University",
    "graduationBranch": "Computer Science",
    "graduationDegree": "B.Tech",
    "graduationMarksPct": 75.5,
    "graduationsPassingYear": "2026",
    "urbanRural": "Urban",
    "scholarshipNumber": "SCHOLAR123",
    "lastSchoolCollegeAttended": "ABC School",
    "bloodGroup": "A+",
    "pastMedicalHistory": "No significant past medical history.",
    "immunisationHistory": "Up-to-date immunizations.",
    "chronicMedicalConditions": "None",
    "parentsEmailId": "[email protected]",
    "parentsContact": 1234567890,
    "relativeContacts": 9876543210,
    "title": "Mr",
    "firstName": "John",
    "middleName": "Doe",
    "motherName": "Jane Doe",
    "gender": "Male",
    "dob": "2023-05-07T06:10:19.426+00:00",
    "age": 32,
    "birthPlace": "Cityville",
    "nationality": "Indian",
    "motherTongue": "English",
    "domicileState": "StateXYZ",
    "religion": "Hindu",
    "castCategory": "General",
    "maharashtraKarnatakaBorderCandidate": true,
    "castDescription": "CasteXYZ",
    "subCasteDescription": "SubCasteXYZ",
    "nonCreamyLayerCertificateAttached": true,
    "hobby": "Reading",
    "passportNo": 1234567890,
    "physicallyHandicapped": false,
    "studentMobNo": 9876543210,
    "studentMail": "[email protected]",
    "parentMobNo": 7890123456,
    "parentMail": "[email protected]",
    "perAddrDescr": "Permanent Address",
    "perPlotNo": 10,
    "perStreetName": "StreetXYZ",
    "perStuAddr1": "Address Line 1",
    "perStuAddr2": "Address Line 2",
    "city": "CityXYZ",
    "percellphone": 9876543210,
    "perpincode": 560001,
    "perresiphone": 7890123456,
    "permailaddress": "[email protected]",
    "country": "India",
    "state": "StateXYZ",
    "district": "DistrictXYZ",
    "tahsil": "TahsilXYZ",
    "correspondanceAddrDescr": "Correspondence Address",
    "correspondancePlotNo": 20,
    "correspondanceStreetName": "Correspondence Street",
    "correspondanceStuAddr1": "Correspondence Address Line 1",
    "correspondanceStuAddr2": "Correspondence Address Line 2",
    "correspondanceCity": "Correspondence City",
    "correspondanceCellPhone": 9876543210,
    "correspondancePincode": 560002,
    "correspondanceResiPhone": 7890123456,
    "correspondanceMailAddress": "[email protected]",
    "correspondanceCountry": "India",
    "correspondanceState": "StateXYZ",
    "correspondanceDistrict": "DistrictXYZ",
    "correspondanceTahsil": "TahsilXYZ",
    "fatherDetails": "FatherXYZ",
    "fathersOccupation": "OccupationXYZ",
    "parentsFirstName": "ParentFirst",
    "parentsMiddleName": "ParentMiddle",
    "parentsLastName": "ParentLast",
    "guardianMobNo": 8765432109,
    "guardianMailId": "[email protected]",
    "nameAsPerTc": "John Doe",
    "casteAsPerTc": "CasteXYZ",
    "birthStatus": "Alive",
    "maritalStatus": true,
    "panCardNo": 987654321,
    "passportExpiry": "2023-05-07T06:10:19.426+00:00",
    "drivingLicNo": 123456789,
    "drivingLicValidTo": "2023-05-07T06:10:19.426+00:00",
    "aadharCardNo": 123456789012,
    "electionCardNo": 9876543210,
    "motherMobNo": 8765432109,
    "motherEmailId": "[email protected]",
    "parentIncome": 100000,
    "photoUploaded": true,
    "signUploaded": true,
    "thumbUploaded": true,
    "noOfDocumentsUploaded": 5
}

Thanks to @TejasNair9977 who helped me to resolve infinite errors that I encountered during this issue

@Vikrantsingh22 Vikrantsingh22 changed the base branch from main to development December 14, 2023 09:31
Copy link
Contributor

@sumitst05 sumitst05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@Aastha-S-Rai Aastha-S-Rai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aastha-S-Rai Aastha-S-Rai merged commit a230e89 into development Dec 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants