Monika Final
Monika Final
An
In
Supervisor Submitted By
July, 2024
SS Jain Subodh PG College
Computer Science Department
Certificate
Date: 31/07/2024
This is to certify that the Industrial Project(MCA – 451) work entitled “University Management
System using React JS, Node JS and Postgre SQL” submitted by Monika Ashok Jat( 22CPGXX661) in
the Department of Computer Science and Application of SS Jain Subodh PG College has been
examined and evaluated.
The project work has been prepared as per the regulation of Rajasthan Technical University Kota and
qualifies to be accepted in partial fulfilment of the requirement for the degree of MCA(Master of
Computer Application_
Dr. Ravi.S.Sharma
External Examiner
Head of Institution/Principal
Candidate Declaration
I hereby declare that the work, which is being presented in the MCA-451, Industrial Project, entitled
“University Management System using React JS, Node Js and Postgre Sql” in partial fulfilment for
the award of Degree of “Master of Computer Application” in Department of Computer Applications
submitted to the SS Jain Subodh PG College, Rajasthan Technical University is a record of my own
work carried under the Guidance of Shri/Dr. Ravi.S.Sharma , Department of Computer Application SS
Jain Subodh PG College.
I have not submitted the matter present in this Project Report any where for the award of any other
Degree.
Dr.Ravi.S.Sharma
Ref No. REG145 Date: 13 November 2023
Certificate
This is to certify that Monika Ashok Jat(22CPGXX661) is/was undertraining from 7th August 2023 to
13th November 2023 under my supervision in partial fulfilment of the requirement for the award of
the Degree of Master of Computer Applications.
During this period he/she has worked on “University Management System” using React Js, Node Js
and Postgre Sql as a Web developer.
Training/Incharge/Project Leader/HR
Subject: Relieving/Experience Letter
Dear Monika,
With reference to your resignation dated 1st November, 2023 resigning from the services of the
company. This is confirmed that the management has accepted the request and you will be
relieved from the services of the company at the closing hours on 13th November 2023.
We take this opportunity to thank you for your contribution to the company and wish you
success in your future endeavors.
www.regexsoftware.com | [email protected]
ABSTRACT
N-Grade deals with the maintenance of university, department, faculty, student information
within the university. N-Grade is an automation system, which is used to store the
Starting from registration of a new student in the university, it maintains all the details
regarding the attendance and marks of the students. The project deals with retrieval of
information through an INTRANET based campus wide portal. It collects related information
from all the departments of an organization and maintains files, which are used to generate
reports in various forms to measure individual and overall performance of the students.
Development process of the system starts with System analysis. System analysis involves
The aim of the project is to develop a university management system that is able to deliver access
to NSU students authorized anytime, anyplace on any device. N-Grade deals with the
This project of N-Grade involved the automation of student information that can be
The uniqueness is being web based and for general-purpose. Being web based means this
system available everywhere through internet. Being general-purpose means system can be
used for all type of documents. The project deals with retrieval of information through an
INTRANET based campus wide portal. It collects related information from all the
departments of an organization and maintains files, which are used to generate reports in
Keep it simple
Extensibility
Use-at-will architecture
The system starts with registration of new staff and students. When the subjects are to be
allocated to the faculty, the Head of the Department should enter everything in the Excel
sheets. Then the staff enters corresponding subject’s attendance and marks of a student then
those must also be entered in the Excel sheets and validations are to be done by the user
itself. So there will be a lot of work to be done and must be more conscious during the
Storing and accessing the data in the form of Excel sheets and account books is a tedious
work. It requires a lot of laborious work. It may often yield undesired results. Maintaining
these records as piles may turn out to be a costlier task than any other of the universities and
institutions.
Present System is time-consuming and also results in lack of getting inefficient results.
Some of the risks involved in the present system are:
During the entrance of marks and attendance, if any mistake is done at a point,
then this becomes cumulative and leads to adverse consequences.
If there is any need to retrieve results it may seem to be difficult to search.
PROPOSED SYSTEM
N-Grade makes management to get the most updated information always by avoiding
manual accounting process. This system has the following functional divisions.
University Administrator
Department Administrator
University Administrator has the functionality of registering new faculties and courses.
modifications in the data entered by the user can also be done by the department
administrator.
User of this may be faculty or students. Faculty has the facility of entering the marks, class
related announcement and attendance of the students. Students can check their marks and
Reports must be generated for the existing data i.e. for attendance and marks of the students,
which are used to assess the performance of the students. These reports should be viewed by
problem and understand its context. The first activity in the phase is studying the existing
system and other is to understand the requirements and domain of the new system. Both the
activities are equally important, but the first activity serves as a basis of giving the functional
specifications and then successful design of the proposed system. Understanding the
properties and requirements of a new system is more difficult and requires creative thinking
Proposed Modules:
Student Registration
Student Fee Control
Student Information Entering and Updating
Student Status
Course Registration
Student Success
Reports and Official Inquiry
Main Page
Entering Exam Results
Course Registration
Student Related Information
Student Success
Communication Facilities
Weekly Class Schedule
Exam Schedule
Student Evaluation
Library Electronic Catalog
Course Registration
Weekly Class Schedule
Exam Schedule
Exams Results
Attendance
Messages from Faculty
Online Publication Databases
Library Electronic Catalog
ANALYSIS MODEL
The model that is basically being followed is the WATER FALL MODEL, which states
that the phases are organized in a linear order. First of all the requirement analysis and project
planning begins. The design starts after the requirement analysis is complete and the coding
begins after the design is complete. Once the programming is completed, the testing is done.
In this model the sequence of activities performed in a software development project are: -
Requirement Analysis
Project Planning
System design
Detail design
Coding
Unit testing
Here the linear ordering of these activities is critical. End of the phase and the output
of one phase is the input of other phase. The output of each phase is to be consistent with the
overall requirement of the system. Some of the qualities of spiral model are also incorporated
like after the people concerned with the project review completion of each of the phase the
work done.
WATER FALL MODEL was being chosen because all requirements were known beforehand
Requirements
Specification
Requirements
Engineering
Design
Specification
Design
Executable
Software
Programming Modules Maintenance
Integrated
Software
Integration Product
Delivered
Software
Delivery Product
1.Environment:
Servers:
Operating System Server: - Microsoft Windows
Data Base Server: Postgres Sql
Clients : Mozilla Firefox, Google Chrome
Tools : Vs code and Postgres Shell
User Interface: React js with redux
Code Behind : Node js and express js
2. Requirements:
Hardware requirements:
Number Description
1 PC with GB hard-disk
and MB RAM
Software requirements:
Number Description
1 Windows
2.
3.
Inputs:
University Administrator enter his user id and password for login to authenticate in this
system
University Administrator creates the faculties and coursed
While registration Courses can able to provide their information like
1. Department id
2. Course name
3. Information of course
4. Password for the id
Administrator can create the various course details in this website.
Registered courses and faculties need to submit their log in information for change their
password.
For searching course details guest need to choose the courses or search course option
for user interface.
For upload their details a faculty must login to their profile
For display they have to view the reports.
Outputs:
Administrator can have his own home page. Courses and faculty and student have their
own home page after completion of the authentication process.
Admin get all courses and faculty and course details.
The registered user’s data can be stored in centralized database through the system user
interface.
Various types of information can be displayed to the users like course offered, courses
faculty and course sections etc
After successful submission of log in information users can got their new password.
Profile can be update by the users individually.
PROCESS MODEL USED WITH JUSTIFICATION
ACCESS CONTROL FOR DATA WHICH REQUIRE USER AUTHENTICAION
The following commands specify access control identifiers and they are typically used to
authorize and authenticate the user (command codes are shown in parentheses)
PASSWORD (PASS)
This command must be immediately preceded by the user name command, and, for some sites,
completes the user's identification for access control. Since password information is quite
sensitive, it is desirable in general to "mask" it or suppress type out.
Input Design:
Input design is a part of overall system design. The main objective during the input
design is as given below:
Input Types:
It is necessary to determine the various types of inputs. Inputs can be categorized as follows:
External inputs, which are prime inputs for the system.
Internal inputs, which are user communications with the system.
Operational, which are computer department’s communications to the system?
Interactive, which are inputs entered during a dialogue.
Input Media:
At this stage choice has to be made about the input media. To conclude about the input
media consideration has to be given to;
Type of input
Flexibility of format
Speed
Accuracy
Verification methods
Rejection rates
Ease of correction
Storage and handling requirements
Security
Easy to use
Portability
Keeping in view the above description of the input types and input media, it can be said
that most of the inputs are of the form of internal and interactive. As
Input data is to be the directly keyed in by the user, the keyboard can be considered to be the
most suitable input device
Error Avoidance:
At this stage care is to be taken to ensure that input data remains accurate form the stage
at which it is recorded up to the stage in which the data is accepted by the system. This can be
achieved only by means of careful control each time the data is handled.
Error Detection:
Even though every effort is make to avoid the occurrence of errors, still a small
proportion of errors is always likely to occur, these types of errors can be discovered by using
validations to check the input data.
Data Validation:
Procedures are designed to detect errors in data at a lower level of detail. Data
validations have been included in the system in almost every area where there is a possibility
for the user to commit errors. The system will not accept invalid data. Whenever an invalid
data is keyed in, the system immediately prompts the user and the user has to again key in the
data and the system will accept the data only if the data is correct. Validations have been
included where necessary.
The system is designed to be a user friendly one. In other words the system has been
designed to communicate effectively with the user. The system has been designed with popup
menus.
User-Initiated Interfaces:
User initiated interfaces fall into two approximate classes:
1. Command driven interfaces: In this type of interface the user inputs commands or queries
which are interpreted by the computer.
2. Forms oriented interface: The user calls up an image of the form to his/her screen and fills
in the form. The forms oriented interface is chosen because it is the best choice.
3. Computer-Initiated Interfaces:
The following computer – initiated interfaces were used:
1. The menu system for the user is presented with a list of alternatives and the user chooses
one; of alternatives.
2. Questions – answer type dialog system where the computer asks question and takes action
based on the basis of the users reply.
Right from the start the system is going to be menu driven, the opening menu displays the
available options. Choosing one option gives another popup menu with more options. In this
way every option leads the users to data entry form where the user can key in the data.
Performance Requirements:
when the requirement specifications are properly given, it is possible to design a system, which
will fit into required environment. It rests largely in the part of the users of the existing system
to give the requirement specifications because they are the people who finally use the system.
This is because the requirements have to be known during the initial stages so that the system
can be designed according to those requirements. It is very difficult to change the system once
it has been designed and on the other hand designing a system, which does not cater to the
The requirement specification for any system can be broadly stated as given below:
The existing system is completely dependent on the user to perform all the duties.
Number of Modules
A module is a bounded contiguous group of statements having a single name and that can be
treated as a unit. In other words, a single block in a pile of blocks.
Make sure modules perform a single task, have a single entry point, and have a single
exit point.
Isolate input-output (I-O) routines into a small number of standard modules that can be
shared system-wide.
Isolate system-dependent functions (e.g., getting date or time) in the application to ease
possible future conversions to other computer platforms or to accommodate future operating
system revisions.
A module is a bounded contiguous group of statements having a single name and that can be
treated as a unit. In other words, a single block in a pile of blocks.
The system after careful analysis has been identified to be presented with the following
modules:
N-Grade makes management to get the most updated information always by avoiding
manual accounting process. This system has the following functional divisions.
University Administrator
Department Administrator
User (Students / Faculties)
Reports
Authentication
University Administrator has the functionality of registering new faculties and courses.
modifications in the data entered by the user can also be done by the college
administrator.
User of this may be faculty or students. Faculty has the facility of entering the marks and
attendance of the students. Students can check their marks and attendance but there is no
chance of modifications.
Reports must be generated for the existing data i.e. for attendance and marks of the
students, which are used to assess the performance of the students. These reports should
Authentication: this module contains all the information about the authenticated user.
. User without his username and password can’t enter into the login if he is only the
index.js
reportWebVitals();
import React, { useEffect, useState } from 'react'
import Footer from '../../GlobalComponent/Footer'
import { Link } from 'react-router-dom'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faColumns, faFileArrowDown, faFileExcel, faFilePdf, faFileText, faPlus,
faPrint, faSearch } from '@fortawesome/free-solid-svg-icons'
import DropdownComponent from '../../GlobalComponent/DropdownComponent'
import InputComponent from '../../GlobalComponent/InputComponent'
import axios from 'axios';
useEffect(() => {
const fetchData = async () => {
try {
useEffect(() => {
const filteredData = Students.filter(student =>
student.firstName.toLowerCase().includes(searchTerm.toLowerCase())
);
setFilteredStudents(filteredData);
}, [searchTerm, Students]);
console.log(Students);
return (
<div className='container'>
<div className=' white-box p-2 ps-3 px-md-3'>
<div className='col d-lg-flex align-items-center justify-
content-between '>
<h3 className='mb-0 ps-0 fw-semibold py-1'>Manage
Student</h3>
<div className='d-flex'>
<Link>
<p className='text-black-50 small me-2'>Dashboard
</p>
</Link>
<p className='text-black-50 small'>|</p>
<Link>
<p className='text-black-50 small mx-2'>Admin
Section</p>
</Link>
<p className='text-black-50 small'>|</p>
<Link>
<p className='text-black-50 small ms-2'>Student
List</p>
</Link>
</div>
</div>
</div>
<div className='row'>
<div className='d-flex align-items-center justify-content-
between'>
<h3>Select Criteria</h3>
<Link to={'/student-admission/id'} className='me-md-3
rounded-5 px-4 fw-semibold small p-1 bg-white a-btn'>
<span><FontAwesomeIcon icon={faPlus} /></span>
<span className='ms-2'>ADD STUDENT</span>
</Link>
</div>
</div>
<div className='white-box py-5'>
<form>
<div className='row'>
<div className='col-lg-4 col-12 my-2 '>
<DropdownComponent optionList={['2024[Jan-Dec]']}
label='ACADEMIC YEAR'
required={true}
/>
</div>
<div className='col-lg-4 my-2 col-12 '>
<DropdownComponent
optionList={['Select Class']}
label='Class'
required={false}
/>
</div>
<div className='col-lg-4 my-2 col-12 '>
<DropdownComponent
optionList={['Select Section']}
label='SECTION'
required={false}
/>
</div>
<div className='col-lg-4 my-2 col-12 '>
<InputComponent
label="SEARCH BY NAME"
type="text"
required={true}
placeholder="Search By Name"
setState={setData}
/>
</div>
<div className='col-lg-4 col-12 my-2'>
<InputComponent
label="SEARCH BY ROLL"
type="text"
required={true}
placeholder="Roll"
setState={setData}
/>
</div>
<div className='col-12 text-end mt-5 '> <a href=''
className='rounded-5 px-4 fw-semibold small p-2 bg-white a-btn'>
<span><FontAwesomeIcon icon={faSearch}
className='' /></span>
<span className='ms-2 text-uppercase '>search</span>
</a></div>
</div>
</form>
</div>
<div className='row'>
<div className='d-sm-flex align-items-center justify-content-
between'>
<h3>Student List</h3>
<div className='border mx-5 mx-sm-0 border-secondary border-
top-0 d-flex align-items-center pb-2 border-start-0 border-end-0'>
<FontAwesomeIcon icon={faSearch} className=' small' />
<input type='text' value={searchTerm}
onChange={handleInputChange} placeholder='Quick Search' className='border-0 bg-
transparent ms-2' />
</div>
<div className='d-none d-xl-block ' >
<ul className='d-flex icon-list rounded-5 px-4 py-0'>
<li ><Link><FontAwesomeIcon icon={faFileArrowDown}
className='text-black-50 p-2 small' /></Link></li>
<li ><Link><FontAwesomeIcon icon={faFileExcel}
className='text-black-50 p-2 small' /></Link></li>
<li ><Link><FontAwesomeIcon icon={faFileText}
className='text-black-50 p-2 small' /></Link></li>
<li ><Link><FontAwesomeIcon icon={faFilePdf}
className='text-black-50 p-2 small' /></Link></li>
<li ><Link><FontAwesomeIcon icon={faPrint}
className='text-black-50 p-2 small' /></Link></li>
<li className='border-0'><Link><FontAwesomeIcon
icon={faColumns} className='text-black-50 p-2 small ' /></Link></li>
</ul>
</div>
</div>
</div>
<div className='white-box '>
<div className='table-responsive'>
<table className='table '>
<thead>
<tr className='table-th border-bottom'>
<th>Admission no</th>
<th>name</th>
<th>Father Name</th>
<th className=' d-none d-md-table-cell'>Date Of
Birth</th>
<th className='d-none d-lg-table-
cell'>Class(Section)</th>
<th className='d-none
d-lg-table-cell'>Gender</th>
<th className='d-none d-xl-table-cell'>Type</th>
<th className='d-none
d-xl-table-cell'>Phone</th>
</tr>
</thead>
<tbody>
{Students && Students.length === 0 ? (
<tr className='table-td'>
<td colSpan="8"><p className='my-3'>No Data
Available In Table</p></td>
</tr>
) : (
filteredStudents && filteredStudents.map((Sdata,
index) => (
<tr className='table-td py-3' key={index}>
<td>{Sdata.admissionNumber }</td>
<td><Link to={`/student-details/$
{Sdata.studentId}`}>{Sdata.firstName} {Sdata.lastName}</Link></td>
<td>{Sdata.fatherName}</td>
<td className='d-none d-md-table-
cell'>{Sdata.dob}</td>
<td className='d-none d-lg-table-
cell'>{Sdata.class}({Sdata.section})</td>
<td className='d-none d-lg-table-
cell'>{Sdata.gender}</td>
<td className='d-none d-xl-table-
cell'>{Sdata.type}</td>
<td className='d-none d-xl-table-
cell'>{Sdata.phone}</td>
</tr>
))
)}
</tbody>
</table>
</div>
</div>
<div aria-label="Page navigation example">
<ul class="pagination justify-content-center ">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true"><p>«</p></span>
</a>
</li>
<li class="page-item"><a class="page-link"
href="#"><p>1</p></a></li>
<li class="page-item"><a class="page-link"
href="#"><p>2</p></a></li>
<li class="page-item"><a class="page-link"
href="#"><p>3</p></a></li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true"><p>»</p></span>
</a>
</li>
</ul>
</div>
<Footer />
</div>
)
}
const initialData = {
collegeId: null,
courseId: null,
academicYear: "",
class: "",
section: "",
admissionNumber: null,
firstName: "",
lastName: "",
gender: "",
dob: "",
bloodGroup: "",
religion: "",
caste: "",
emailAddress: "",
phone: null,
admissionDate: "",
category: "",
group: "",
height: null,
weight: null,
fatherName: "",
fatherOccupation: "",
fatherNumber: null,
motherName: "",
motherOccupation: "",
motherNumber: null,
guardianName: "",
guardianOccupation: "",
guardianNumber: null,
guardianEmail: "",
guardianAddress: "",
currentAddress: "",
permanentAddress: "",
routeList: "",
vehicleNumber: "",
dormitory: "",
roomNumber: "",
nationalIdCard: "",
birthCertificateNumber: "",
bankAccountNumber: null,
bankName: "",
previousSchoolDetails: "",
additionalNotes: "",
ifscCode: "",
studentPhoto:null,
fatherPhoto:null,
motherPhoto:null,
guardianPhoto:null,
documentsIstPhoto: null,
documentsSecondPhoto: null,
documentsThirdPhoto: null,
documentsFourthPhoto:null
}
const StudentAdmission = () => {
let id = useParams();
const [studentData, setStudentData] = useState(initialData);
const [DropdownList, setDropdownList] = useState(null);
const [file, setFile] = useState('');
useEffect(() => {
const fetchData = async () => {
try {
const response = await
axios.get('http://localhost:8080/setting/all?settingstype=student');
if (id.studentId === 'id') {
const admissionNumber = await
axios.get('http://localhost:8080/student/admissionNumber');
setStudentData(initialData)
setStudentData(studentData => ({
...studentData,
'admissionNumber': admissionNumber.data
}));
} else {
const singleStudent = await
axios.get(`http://localhost:8080/student?studentId=${id.studentId}`);
setStudentData(singleStudent.data);
}
setDropdownList(response.data.data);
} catch (error) {
console.error('Error fetching data:', error);
}
};
fetchData();
}, [id.studentId]);
function selectDropdownList(selected){
if (DropdownList && DropdownList.length > 0) {
const setting = DropdownList.find(item => item.settingKey ===
selected);
if (setting) {
return setting.settingValue;
} else {
return [];
}
}
}
const handleSubmit = async (e) => {
e.preventDefault();
try {
form.append(key, studentData[key]);
}
// for (const [key, value] of form.entries()) {
// console.log(`${key}: ${value}`);
// }
console.log('ssssssa', form);
} catch (error) {
console.error('Error sending form data:', error);
// alert('Error Submit data:')
}
};
console.log(id.studentId);
return (
<div className='container'>
<div className=' white-box p-2 ps-3 px-md-3'>
<div className='col d-lg-flex align-items-center justify-
content-between '>
{id.studentId != 'id' ? <h3 className='mb-0 ps-0 fw-semibold
py-1 '>Modify Student</h3> : <h3 className='mb-0 ps-0 fw-semibold py-1'>Student
Admission</h3>}
<div className='d-flex'>
<Link>
<p className='text-black-50 small me-2'>Dashboard
</p>
</Link>
<p className='text-black-50 small'>|</p>
<Link>
<p className='text-black-50 small mx-2'>Admin
Section</p>
</Link>
<p className='text-black-50 small'>|</p>
<Link>
{id.studentId != 'id' ? <p className='text-black-50
small ms-2'>Modify Student</p> : <p className='text-black-50 small ms-2'>Student
Admission</p>}
</Link>
</div>
</div>
</div>
<div className='row'>
<div className='d-flex align-items-center justify-content-
between'>
<h3>Add Student</h3>
<Link to={'/import-student'} className='me-md-5 rounded-5
px-4 fw-semibold small p-1 bg-white a-btn'>
<span><FontAwesomeIcon icon={faPlus} /></span>
<span className='ms-2 small fw-bold'>IMPORT
STUDENT</span>
</Link>
</div>
</div>
<div className='white-box'>
<div className='col-12'>
<h4 className='small border-bottom pb-1 ps-1'>PERSONAL
INFO</h4>
</div>
<form onSubmit={handleSubmit}>
<div className='row'>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'academicYear'}
setState={setStudentData}
optionList={['2024[Jan-Dec]', '2023-2024',
'2024-2025']}
label='ACADEMIC YEAR '
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'collegeId'}
setState={setStudentData}
optionList={['Select Collage','1','2']}
label='Collage'
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'courseId'}
setState={setStudentData}
optionList={['Select Course','1','2','3']}
label='Course'
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'class'}
setState={setStudentData}
optionList={selectDropdownList('class')}
label='CLASS'
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'section'}
setState={setStudentData}
optionList={selectDropdownList('section')}
label='Section'
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="ADMISSION NUMBER"
type="text"
required={true}
inputName='admissionNumber'
prevData={studentData}
placeholder=""
setState={setStudentData}
isDisabled={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="Roll"
type="text"
required={true}
inputName='rollNumber'
prevData={studentData}
placeholder=""
setState={setStudentData}
isDisabled={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="First Name"
type="text"
required={true}
inputName='firstName'
prevData={studentData}
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="LAST NAME "
type="text"
required={true}
inputName='lastName'
prevData={studentData}
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'gender'}
setState={setStudentData}
optionList={['Male','Female','Other']}
label='GENDER'
required={true}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="DATE OF BIRTH"
type="date"
required={false}
prevData={studentData}
inputName='dob'
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'bloodGroup'}
setState={setStudentData}
optionList={selectDropdownList('bloodGroup')}
label='BLOOD GROUP'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'religion'}
setState={setStudentData}
optionList={selectDropdownList('religion')}
label='RELIGION'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="CASTE "
type="text"
required={false}
inputName='caste'
prevData={studentData}
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="EMAIL ADDRESS "
type="email"
required={false}
prevData={studentData}
inputName='emailAddress'
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="PHONE NUMBER"
type="number"
prevData={studentData}
inputName='phone'
required={true}
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="ADMISSION DATE"
type="date"
required={false}
prevData={studentData}
inputName='admissionDate'
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'category'}
setState={setStudentData}
optionList={selectDropdownList('category')}
label='CATEGORY'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'group'}
setState={setStudentData}
optionList={selectDropdownList('group')}
label='GROUP'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="HEIGHT (IN)"
type="text"
inputName='height'
prevData={studentData}
required={false}
placeholder=""
setState={setStudentData}
bootstrapClass=''
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="WEIGHT (KG)"
type="text"
inputName='weight'
prevData={studentData}
required={false}
placeholder=""
setState={setStudentData}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="Image"
type="file"
required={false}
inputName='studentPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass="custom-file-input"
/>
</div>
<div className='col-12 my-3'>
<h4 className='small border-bottom pb-1 ps-
1'>PARENTS & GUARDIAN INFO</h4>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="FATHER NAME"
type="text"
required={false}
prevData={studentData}
inputName='fatherName'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="OCCUPATION"
type="text"
required={false}
prevData={studentData}
inputName='fatherOccupation'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="FATHER PHONE"
type="text"
required={false}
prevData={studentData}
inputName='fatherNumber'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="FATHERS PHOTO"
type="file"
required={false}
inputName='fatherPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass="custom-file-input"
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="Mother NAME"
type="text"
required={false}
prevData={studentData}
inputName='motherName'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="OCCUPATION"
type="text"
required={false}
prevData={studentData}
inputName='motherOccupation'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="Mother PHONE"
type="text"
required={false}
prevData={studentData}
inputName='motherNumber'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="Mother PHOTO"
type="file"
required={false}
inputName='motherPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass="custom-file-input"
/>
</div>
<div className='my-2 col-12 d-flex align-items-center
justify-content'>
<h4 className='small'>RELATION WITH GUARDIAN</h4>
<div className='d-flex align-items-center mx-sm-3
mx-1'><input type='radio' name='relation' /><p className='ms-2'> Father
</p></div>
<div className='d-flex align-items-center mx-sm-3
mx-1'><input type='radio' name='relation' /> <p
className='ms-2'>Mother</p></div>
<div className='d-flex align-items-center mx-sm-3
mx-1 '><input type='radio' name='relation' /> <p
className='ms-2'>Other</p></div>
</div>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="RELATION WITH GUARDIAN"
type="text"
required={false}
prevData={file}
inputName='d'
placeholder=""
setState={setFile}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="GUARDIANS EMAIL"
type="email"
required={true}
prevData={studentData}
inputName='guardianEmail'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="GUARDIAN PHOTO"
type="file"
required={false}
inputName='guardianPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass=" custom-file-input"
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="GUARDIANS PHONE"
type="text"
required={false}
prevData={studentData}
inputName='guardianNumber'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="GUARDIAN OCCUPATION"
type="text"
required={false}
prevData={studentData}
inputName='guardianOccupation'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="GUARDIAN ADDRESS"
type="text"
required={false}
prevData={studentData}
inputName='guardianAddress'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-12 my-3'>
<h4 className='small border-bottom pb-1 ps-
1'>STUDENT ADDRESS INFO</h4>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="CURRENT ADDRESS"
type="text"
required={false}
prevData={studentData}
inputName='currentAddress'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="PERMANENT ADDRESS"
type="text"
required={false}
prevData={studentData}
inputName='permanentAddress'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-12 my-3'>
<h4 className='small border-bottom pb-1 ps-
1'>TRANSPORT</h4>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'routeList'}
setState={setStudentData}
optionList={selectDropdownList('routeList')}
label='Route List'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'vehicleNumber'}
setState={setStudentData}
optionList={selectDropdownList('vehicleNumber')}
label='Vehicle Number'
required={false}
/>
</div>
<div className='col-12 my-3'>
<h4 className='small border-bottom pb-1 ps-1'>OTHER
INFO</h4>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'dormitory'}
setState={setStudentData}
optionList={selectDropdownList('dormitory')}
label='Dormitory'
required={false}
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<DropdownComponent
prevData={studentData}
dropdownName={'roomNumber'}
setState={setStudentData}
optionList={selectDropdownList('roomNumber')}
label='Room Number'
required={false}
/>
</div>
<div className='col-12 my-3'>
<h4 className='small border-bottom pb-1 ps-
1'>DOCUMENT INFO</h4>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="NATIONAL ID CARD"
type="text"
required={false}
prevData={studentData}
inputName='nationalIdCard'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="Birth Certificate Number"
type="text"
required={false}
prevData={studentData}
inputName='birthCertificateNumber'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="BANK ACCOUNT NUMBER"
type="text"
required={false}
prevData={studentData}
inputName='bankAccountNumber'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="BANK NAME"
type="text"
required={false}
prevData={studentData}
inputName='bankName'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-4 col-lg-6 my-2 col-12'>
<InputComponent
label="PREVIOUS SCHOOL DETAILS"
type="text"
required={false}
prevData={studentData}
inputName='previousSchoolDetails'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-4 col-lg-6 my-2 col-12'>
<InputComponent
label="ADDITIONAL NOTES"
type="text"
required={false}
prevData={studentData}
inputName='additionalNotes'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-4 col-lg-6 my-2 col-12'>
<InputComponent
label="IFSC CODE"
type="text"
required={false}
prevData={studentData}
inputName='ifscCode'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="DOCUMENT 01 TITLE"
type="text"
required={false}
prevData={studentData}
inputName='documentsIst'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="DOCUMENT 02 TITLE"
type="text"
required={false}
prevData={studentData}
inputName='documentsSecond'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="DOCUMENT 03 TITLE"
type="text"
required={false}
prevData={studentData}
inputName='documentsThird'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12'>
<InputComponent
label="DOCUMENT 04 TITLE"
type="text"
required={false}
prevData={studentData}
inputName='documentsFourth'
placeholder=""
setState={setStudentData}
bootstrapClass=""
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="01"
type="file"
required={false}
inputName='documentsIstPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass=" custom-file-input"
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="01"
type="file"
required={false}
inputName='documentsSecondPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass=" custom-file-input"
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="01"
type="file"
required={false}
inputName='documentsThirdPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass=" custom-file-input"
/>
</div>
<div className='col-xl-3 col-lg-6 my-2 col-12 pe-0
position-relative'>
<InputComponent
label="01"
type="file"
required={false}
inputName='documentsFourthPhoto'
prevData={studentData}
placeholder=""
setState={setStudentData}
bootstrapClass=" custom-file-input"
/>
</div>
</div>
<div className='d-flex justify-content-center my-4'>
<button type='submit' className='rounded-3 px-4 fw-
semibold small p-2 bg-white a-btn'>
<span><FontAwesomeIcon icon={faCheck}
className='' /></span>
{id.studentId != 'id' ? <span className='ms-2 text-
uppercase '>Update Student</span> : <span className='ms-2 text-uppercase '>Save
Student</span>}
</button>
</div>
</form>
</div>
<Footer />
</div>
)
}
};
return (
<>
<div className='container'>
<h3>Welcome - Aayojaan School | Super admin</h3>
<div className='row'>
<div className='col-lg-3 col-md-6 col-sm-6 '>
<a href='' className='d-block text-decoration-none '>
<div className='white-box-hover white-box d-flex
justify-content-between'>
<div className=''>
<h3 className='p-0 m-0 fw-
semibold'>Student</h3>
<p>Total Students</p>
</div>
<h4 className='text-warning'>2</h4>
</div>
</a>
</div>
<div className='col-lg-3 col-md-6 col-sm-6 '>
<a href='' className='d-block text-decoration-none '>
<div className='white-box white-box-hover d-flex
justify-content-between'>
<div className=''>
<h3 className='p-0 m-0 fw-
semibold'>Teachers</h3>
<p>Total Teachers</p>
</div>
<h4 className='text-warning'>0</h4>
</div>
</a>
</div>
<div className='col-lg-3 col-md-6 col-sm-6 '>
<a href='' className='d-block text-decoration-none '>
<div className='white-box white-box-hover d-flex
justify-content-between'>
<div className=''>
<h3 className='p-0 m-0 fw-
semibold'>Parents</h3>
<p>Total Parents</p>
</div>
<h4 className='text-warning'>2</h4>
</div>
</a>
</div>
<div className='col-lg-3 col-md-6 col-sm-6 '>
<a href='' className='d-block text-decoration-none '>
<div className='white-box white-box-hover d-flex
justify-content-between'>
<div className=''>
<h3 className='p-0 m-0 fw-
semibold'>Staffs</h3>
<p>Total Staffs</p>
</div>
<h4 className='text-warning'>0</h4>
</div>
</a>
</div>
</div>
<h3>Income and Expenses for Jun 2023</h3>
<div className='white-box'>
<div className='row '>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 0</h1>
<p>Total Income</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 0</h1>
<p>Total Expenses</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 0</h1>
<p>Total Profit</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 0</h1>
<p>Total Revenue</p>
</div>
</div>
<div className='row px-md-5'>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
</div>
</div>
</div>
<h3>Income and Expenses for 2023</h3>
<div className='white-box'>
<div className='row '>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 1,000</h1>
<p>Total Income</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 0</h1>
<p>Total Expenses</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 1,000</h1>
<p>Total Profit</p>
</div>
</div>
<div className='col-lg-2 col-md-6 col-6 mx-auto'>
<div className='text-center'>
<h1>(₹) 1,000</h1>
<p>Total Revenue</p>
</div>
</div>
<div className='row px-md-5'>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
<div className='col-12 my-3'><hr /></div>
</div>
</div>
</div>
<div className='row'>
<div className='d-flex align-items-center justify-content-
between'>
<h3>Notice Board</h3>
<a href='' className='me-md-5 rounded-5 px-4 fw-semibold
small p-1 bg-white a-btn'>
<span><FontAwesomeIcon icon={faPlus} /></span>
<span className='ms-2'>ADD</span>
</a>
</div>
<div className='col-lg-12'>
<div className='white-box'>
<table className='w-100'>
<thead>
<tr className="table-th">
<th>Date</th>
<th>Title</th>
<th className='d-flex justify-content-
around'>Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div className='row'>
<div className='col-lg-8 col-12'>
<h3>Calendar</h3>
<div className="white-box">
<div className="card-body p-sm-2">
<CustomCalendar
onChange={onChange}
value={date}
className="custom-calendar"
/>
</div>
</div>
</div>
<div className='col-lg-4 col-12 '>
<div className='d-flex justify-content-between align-
items-baseline'>
<h3>To Do List</h3>
<a href='' className='me-md-5 rounded-5 px-4 fw-
semibold small p-1 bg-white a-btn'>
<span><FontAwesomeIcon icon={faPlus} /></span>
<span className='ms-2'>ADD</span>
</a>
</div>
<div className='col-12'>
<div className='white-box py-4 mt-2'>
<div className='d-flex justify-content-between'>
<a href='' className=' rounded-5 fw-semibold
small p-2 py-1 a-btn'>
<span className='fw-semibold text-
uppercase '>Incomplete</span>
</a>
<a href='' className=' rounded-5 fw-semibold
small p-2 py-1 bg-gradient a-btn'>
<span className='fw-semibold text-
uppercase text-primary-emphasis'>completed</span>
</a>
</div>
<p className='text-black-50 small my-3'>No Do
Lists Assigned Yet</p>
</div>
</div>
</div>
</div>
<Footer />
</div>
</>
)
}
// router
import {Router} from ’express’
const router = Router();
router.post(’/’, addStudent);
router.get(’/all’, getAllStudents);
router.get(’/’, getSingleStudentDetail);
router.post(’/import’, importStudentData);
router.patch(’/:studentId’, updateStudentDetails);
router.delete(’/:studentId’, deleteStudentDetail);
router.get(’/emptyEnrollNumber’, getEmptyEnrollNumber);
// 1. create student
export const addStudent = async (req,res) => {
const file = req.files;
let {universityId,campusId,instituteId,affiliatedUniversityId,courseLevelId,courseId,email,enrollNumber}
= req.body
const checkExistingEmail = await checkEmail(email)
const checkExistingEnroll = await checkEnroll(enrollNumber)
try {
if (!(universityId && campusId && instituteId && affiliatedUniversityId && courseLevelId &&
courseId)){
res.status(400).send("universityId,campusId,instituteId,affiliatedUniversityId,courseLevelId and
courseId is required");
}
if(email){
if(checkExistingEmail){
if (email.toLowerCase() === checkExistingEmail.dataValues.email.toLowerCase()){
res.status(400).send("Email is already existing");
}
}
}else{
res.status(400).send("email is required");
}
if(enrollNumber){
if(checkExistingEnroll){
if (enrollNumber.toLowerCase() ===
checkExistingEnroll.dataValues.enroll_number.toLowerCase()){
res.status(400).send("Enroll is already existing");
}
}
}
const info = req.body
const result = await studentService.addStudent(info,file);
res.status(200).send(result);
} catch (error) {
console.error("Error in add Student:", error);
res.status(500).send("Internal Server Error");
}
};
// update student
export const updateStudentDetails = async (req,res) => {
const {studentId,universityId,campusId,instituteId,affiliatedUniversityId,courseLevelId,courseId} =
req.body;
const info = req.body;
const file = req.files;
try {
if (!(studentId && universityId && campusId && instituteId && affiliatedUniversityId && courseLevelId
&& courseId )){
res.status(400).send("student
Id,universityId,campusId,instituteId,affiliatedUniversityId,courseLevelId and courseId is required");
}
const result = await studentService.updateStudentDetails(studentId, info,file);
res.status(200).send(result);
} catch (error) {
console.error(‘Error in updating student Id ${studentId} and ${campusId}:‘, error);
res.status(500).send("Internal Server Error");
}
};
await Promise.all(uploadPromises);
// Documents status
const settingKey = ’studentDocument’;
const getstudentDocuments = await getSettingValue(settingKey);
const studentRequiredDocuments = getstudentDocuments.dataValues.setting_value;
let allFilesUploaded = true;
for (let i = 0; i < studentRequiredDocuments.length; i++) {
const key = studentRequiredDocuments[i];
if (!info[key]) {
allFilesUploaded = false;
break;
}
}
if (allFilesUploaded) {
info.documentStatus = ’Complete Documents’;
}
if (allFilesUploaded) {
info.documentStatus = ’Complete Documents’;
}
fs.createReadStream(filePath)
.pipe(csv())
.on(’data’, (data) => results.push(data))
.on(’end’, () => resolve(results))
.on(’error’, (error) => reject(new Error(’Error reading CSV file: ’ + error.message)));
});
};
router.get(’/all’, getAllCollegesAndCourses);
router.post(’/campus’, addCampus);
router.post(’/institute’, addInstitute);
router.post(’/affiliatedUniversity’, addAffiliatedUniversity);
router.post(’/affiliatedUniversity’, addAffiliatedUniversity);
router.post(’/courseLevel’, addCourseLevel);
router.post(’/course’, addCourse);
router.post(’/specialization’, addSpecialization);
return {
allUniversity,
allCampus,
allInstitute,
allAffiliatedIniversity,
allCourseLevel,
allCourse,
allSpecialization
};
} catch (error) {
console.error(’Error fetching all Course details:’, error);
throw error;
}
};
export async function addCampus(data) {
const { universityId, campuses } = data;
try {
const createdCampuses = [];
for (const campus of campuses) {
const campusData = { ...campus, universityId };
const createdCampus = await mainRepository.addCampus(campusData);
createdCampuses.push(createdCampus);
}
return createdCampuses;
} catch (error) {
console.error(’Add Campus Error in Service:’, error);
throw error;
}
};
// for Add
Campus Model