@eeplatform/basic-edu 1.3.11 → 1.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +18 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,8 @@ type BasicEducEnrForm = {
|
|
|
87
87
|
cityMunicipality: string;
|
|
88
88
|
division: string;
|
|
89
89
|
divisionName?: string;
|
|
90
|
-
|
|
90
|
+
schoolId: string;
|
|
91
|
+
school: ObjectId;
|
|
91
92
|
schoolName?: string;
|
|
92
93
|
schoolYear: string;
|
|
93
94
|
gradeLevel: string;
|
|
@@ -176,7 +177,8 @@ declare function MEnrollment(value: BasicEducEnrForm): {
|
|
|
176
177
|
cityMunicipality: string;
|
|
177
178
|
division: string;
|
|
178
179
|
divisionName: string;
|
|
179
|
-
school:
|
|
180
|
+
school: ObjectId;
|
|
181
|
+
schoolId: string;
|
|
180
182
|
schoolName: string;
|
|
181
183
|
schoolYear: string;
|
|
182
184
|
gradeLevel: string;
|
package/dist/index.js
CHANGED
|
@@ -1904,9 +1904,11 @@ var schemaEnrollment = import_joi3.default.object({
|
|
|
1904
1904
|
division: import_joi3.default.string().required(),
|
|
1905
1905
|
// Changed from hex to string to match frontend
|
|
1906
1906
|
divisionName: import_joi3.default.string().optional().allow("", null),
|
|
1907
|
-
|
|
1907
|
+
schoolId: import_joi3.default.string().required(),
|
|
1908
1908
|
// Changed from hex to string to match frontend
|
|
1909
|
-
|
|
1909
|
+
school: import_joi3.default.string().hex().required(),
|
|
1910
|
+
// Added to match frontend
|
|
1911
|
+
schoolName: import_joi3.default.string().required(),
|
|
1910
1912
|
// Added to match frontend
|
|
1911
1913
|
schoolYear: import_joi3.default.string().required(),
|
|
1912
1914
|
gradeLevel: import_joi3.default.string().valid(...gradeLevels).required(),
|
|
@@ -1977,6 +1979,7 @@ function MEnrollment(value) {
|
|
|
1977
1979
|
division: value.division,
|
|
1978
1980
|
divisionName: value.divisionName ?? "",
|
|
1979
1981
|
school: value.school,
|
|
1982
|
+
schoolId: value.schoolId,
|
|
1980
1983
|
schoolName: value.schoolName ?? "",
|
|
1981
1984
|
// Added to match frontend
|
|
1982
1985
|
schoolYear: value.schoolYear ?? "",
|
|
@@ -2109,7 +2112,11 @@ function useEnrollmentRepo() {
|
|
|
2109
2112
|
status
|
|
2110
2113
|
};
|
|
2111
2114
|
if (school) {
|
|
2112
|
-
|
|
2115
|
+
try {
|
|
2116
|
+
query.school = new import_mongodb4.ObjectId(school);
|
|
2117
|
+
} catch (error) {
|
|
2118
|
+
throw new import_nodejs_utils5.BadRequestError("Invalid school ID.");
|
|
2119
|
+
}
|
|
2113
2120
|
}
|
|
2114
2121
|
if (schoolYear) {
|
|
2115
2122
|
query.schoolYear = schoolYear;
|
|
@@ -2156,41 +2163,13 @@ function useEnrollmentRepo() {
|
|
|
2156
2163
|
});
|
|
2157
2164
|
return cached;
|
|
2158
2165
|
}
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2161
|
-
{
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
// School collection still uses ObjectId, we'll need to convert during lookup
|
|
2167
|
-
as: "schoolInfo"
|
|
2168
|
-
}
|
|
2169
|
-
},
|
|
2170
|
-
{
|
|
2171
|
-
$lookup: {
|
|
2172
|
-
from: "admin.regions",
|
|
2173
|
-
localField: "region",
|
|
2174
|
-
foreignField: "_id",
|
|
2175
|
-
// Region collection still uses ObjectId, we'll need to convert during lookup
|
|
2176
|
-
as: "regionInfo"
|
|
2177
|
-
}
|
|
2178
|
-
},
|
|
2179
|
-
{
|
|
2180
|
-
$lookup: {
|
|
2181
|
-
from: "admin.divisions",
|
|
2182
|
-
localField: "division",
|
|
2183
|
-
// Changed from sdo to division to match frontend
|
|
2184
|
-
foreignField: "_id",
|
|
2185
|
-
// Division collection still uses ObjectId, we'll need to convert during lookup
|
|
2186
|
-
as: "divisionInfo"
|
|
2187
|
-
// Changed from sdoInfo to divisionInfo
|
|
2188
|
-
}
|
|
2189
|
-
},
|
|
2190
|
-
{ $sort: sort },
|
|
2191
|
-
{ $skip: page * limit },
|
|
2192
|
-
{ $limit: limit }
|
|
2193
|
-
]).toArray();
|
|
2166
|
+
const pipeline = [{ $match: query }];
|
|
2167
|
+
if (Object.keys(sort).length) {
|
|
2168
|
+
pipeline.push({ $sort: sort });
|
|
2169
|
+
}
|
|
2170
|
+
pipeline.push({ $skip: page * limit });
|
|
2171
|
+
pipeline.push({ $limit: limit });
|
|
2172
|
+
const items = await collection.aggregate(pipeline).toArray();
|
|
2194
2173
|
const length = await collection.countDocuments(query);
|
|
2195
2174
|
const data = (0, import_nodejs_utils5.paginate)(items, page, limit, length);
|
|
2196
2175
|
setCache(cacheKey, data, 600).then(() => {
|
|
@@ -2504,7 +2483,7 @@ function useEnrollmentService() {
|
|
|
2504
2483
|
placeOfBirth: value.learnerInfo.placeOfBirth,
|
|
2505
2484
|
gradeLevel: value.gradeLevel,
|
|
2506
2485
|
schoolYear: value.schoolYear,
|
|
2507
|
-
school: value.
|
|
2486
|
+
school: value.schoolId
|
|
2508
2487
|
});
|
|
2509
2488
|
if (applicantInfo.accepted) {
|
|
2510
2489
|
throw new import_nodejs_utils6.BadRequestError(
|