Skip to content

Commit d7293d1

Browse files
[added] crud for stu education history
1 parent 2b96c47 commit d7293d1

File tree

3 files changed

+198
-59
lines changed

3 files changed

+198
-59
lines changed

models/student/stdEduHistory.js

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
import connector from "#models/databaseUtil";
2+
3+
const studentEducationSchema = {
4+
uid: { type: String, require: true },
5+
// tenth_details
6+
tenth: {
7+
marks: { type: String, required: true },
8+
percentage: { type: Number, required: true },
9+
seat_number: { type: String, required: true },
10+
exam_name: { type: String, required: true },
11+
exam_board: { type: String, required: true },
12+
ms_oms: { type: String, required: true },
13+
merit_number_in_qualifying_exam: { type: String, required: true },
14+
admitted_number: { type: String, required: true },
15+
},
16+
cet_hsc_details: {
17+
cet_roll_no: { type: String, required: true },
18+
cet_marks: { type: String, required: true },
19+
qualifying_exam_for_admission: { type: String, required: true },
20+
std_type: { type: String, required: true },
21+
stream_opted: { type: String, required: true },
22+
medium_of_instruction: { type: String, required: true },
23+
agg_total_marks: { type: Number, required: true },
24+
total_marks_out_of: { type: Number, required: true },
25+
percent_of_marks: { type: String, required: true },
26+
attempt_no: { type: String, required: true },
27+
passing_month: { type: String, required: true },
28+
passing_year: { type: String, required: true },
29+
institution_name: { type: String, required: true },
30+
educ_board_name: { type: String, required: true },
31+
pcm_percent: { type: String, required: true },
32+
pbm_percent: { type: String, required: true },
33+
stu_qualifying_exam: { type: String, required: true },
34+
marks_obtained: { type: String, required: true },
35+
state_rank: { type: String, required: true },
36+
prev_exam_seat_number: { type: String, required: false },
37+
prev_tc_number: { type: String, required: false },
38+
hsc_passed_school_name: { type: String, required: true },
39+
board_pattern: { type: String, required: true },
40+
scholarship_name: { type: String, required: false },
41+
scholarship_type: { type: String, required: false },
42+
dte_seat_type: { type: String, required: true },
43+
dte_user_password: { type: String, required: true },
44+
dte_user_id: { type: String, required: true },
45+
},
46+
graduation_details: {
47+
graduation_institute: { type: String, required: true },
48+
graduation_branch: { type: String, required: true },
49+
graduation_degree: { type: String, required: true },
50+
graduation_marks_pct: { type: Number, required: true },
51+
graduations_passing_year: { type: String, required: true },
52+
urban_rural: { type: String, required: true },
53+
scholarship_number: { type: String, required: false },
54+
last_school_college_attended: { type: String, required: true },
55+
},
56+
};
57+
58+
const studentEducation = connector.model("Student education", studentEducationSchema);
59+
60+
async function create(studentEducationData) {
61+
const {
62+
uid,
63+
tenth: {
64+
marks,
65+
percentage,
66+
seat_number,
67+
exam_name,
68+
exam_board,
69+
ms_oms,
70+
merit_number_in_qualifying_exam,
71+
admitted_number,
72+
},
73+
cet_hsc_details: {
74+
cet_roll_no,
75+
cet_marks,
76+
qualifying_exam_for_admission,
77+
std_type,
78+
stream_opted,
79+
medium_of_instruction,
80+
agg_total_marks,
81+
total_marks_out_of,
82+
percent_of_marks,
83+
attempt_no,
84+
passing_month,
85+
passing_year,
86+
institution_name,
87+
educ_board_name,
88+
pcm_percent,
89+
pbm_percent,
90+
stu_qualifying_exam,
91+
marks_obtained,
92+
state_rank,
93+
prev_exam_seat_number,
94+
prev_tc_number,
95+
hsc_passed_school_name,
96+
board_pattern,
97+
scholarship_name,
98+
scholarship_type,
99+
dte_seat_type,
100+
dte_user_password,
101+
dte_user_id,
102+
},
103+
graduation_details: {
104+
graduation_institute,
105+
graduation_branch,
106+
graduation_degree,
107+
graduation_marks_pct,
108+
graduations_passing_year,
109+
urban_rural,
110+
scholarship_number,
111+
last_school_college_attended,
112+
},
113+
} = studentEducationData;
114+
115+
const stdEducation = new studentEducation({
116+
uid,
117+
tenth: {
118+
marks,
119+
percentage,
120+
seat_number,
121+
exam_name,
122+
exam_board,
123+
ms_oms,
124+
merit_number_in_qualifying_exam,
125+
admitted_number,
126+
},
127+
cet_hsc_details: {
128+
cet_roll_no,
129+
cet_marks,
130+
qualifying_exam_for_admission,
131+
std_type,
132+
stream_opted,
133+
medium_of_instruction,
134+
agg_total_marks,
135+
total_marks_out_of,
136+
percent_of_marks,
137+
attempt_no,
138+
passing_month,
139+
passing_year,
140+
institution_name,
141+
educ_board_name,
142+
pcm_percent,
143+
pbm_percent,
144+
stu_qualifying_exam,
145+
marks_obtained,
146+
state_rank,
147+
prev_exam_seat_number,
148+
prev_tc_number,
149+
hsc_passed_school_name,
150+
board_pattern,
151+
scholarship_name,
152+
scholarship_type,
153+
dte_seat_type,
154+
dte_user_password,
155+
dte_user_id,
156+
},
157+
graduation_details: {
158+
graduation_institute,
159+
graduation_branch,
160+
graduation_degree,
161+
graduation_marks_pct,
162+
graduations_passing_year,
163+
urban_rural,
164+
scholarship_number,
165+
last_school_college_attended,
166+
},
167+
});
168+
const stdEducationDoc = await stdEducation.save();
169+
return stdEducationDoc;
170+
171+
}
172+
173+
174+
async function read(filter, limit = 1) {
175+
const stdEducationDoc = studentEducationSchema.find(filter).limit(limit);
176+
return stdEducationDoc
177+
}
178+
179+
async function update(filter, updateObject, options = { multi: true }) {
180+
const updateResult = await studentEducationSchema.updateMany(
181+
filter,
182+
{ $set: updateObject },
183+
options,
184+
);
185+
return updateResult.acknowledged;
186+
}
187+
188+
async function remove(stdEducationId) {
189+
const deleteResult = await studentEducationSchema.deleteMany(stdEducationId);
190+
return deleteResult.acknowledged;
191+
}
192+
193+
export default {
194+
create,
195+
read,
196+
update,
197+
remove,
198+
};

models/student/std_edu_history.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

services/student/stdEduHistory.js

Whitespace-only changes.

0 commit comments

Comments
 (0)