@eeplatform/basic-edu 1.9.1 → 1.9.2
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 +2 -2
- package/dist/index.js +13 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -336,7 +336,7 @@ declare function MLearner(value: TEnrollment): {
|
|
|
336
336
|
declare function useEnrollmentRepo(): {
|
|
337
337
|
createIndexes: () => Promise<void>;
|
|
338
338
|
add: (value: TLearner, session?: ClientSession) => Promise<ObjectId>;
|
|
339
|
-
getAll: ({ search, page, limit, sort, status, school, schoolYear,
|
|
339
|
+
getAll: ({ search, page, limit, sort, status, school, schoolYear, createdBy, gradeLevel, }?: {
|
|
340
340
|
search?: string | undefined;
|
|
341
341
|
page?: number | undefined;
|
|
342
342
|
limit?: number | undefined;
|
|
@@ -344,8 +344,8 @@ declare function useEnrollmentRepo(): {
|
|
|
344
344
|
status?: string | undefined;
|
|
345
345
|
school?: string | undefined;
|
|
346
346
|
schoolYear?: string | undefined;
|
|
347
|
-
gradeLevelToEnroll?: string | undefined;
|
|
348
347
|
createdBy?: string | undefined;
|
|
348
|
+
gradeLevel?: string | undefined;
|
|
349
349
|
}) => Promise<Record<string, any> | {
|
|
350
350
|
items: any[];
|
|
351
351
|
pages: number;
|
package/dist/index.js
CHANGED
|
@@ -3224,17 +3224,19 @@ function useEnrollmentRepo() {
|
|
|
3224
3224
|
status = "active",
|
|
3225
3225
|
school = "",
|
|
3226
3226
|
schoolYear = "",
|
|
3227
|
-
|
|
3228
|
-
|
|
3227
|
+
createdBy = "",
|
|
3228
|
+
gradeLevel = ""
|
|
3229
3229
|
} = {}) {
|
|
3230
3230
|
page = page > 0 ? page - 1 : 0;
|
|
3231
3231
|
const query = {
|
|
3232
3232
|
status
|
|
3233
3233
|
};
|
|
3234
3234
|
const cacheParams = {
|
|
3235
|
+
status,
|
|
3235
3236
|
page,
|
|
3236
3237
|
limit,
|
|
3237
|
-
sort: JSON.stringify(sort)
|
|
3238
|
+
sort: JSON.stringify(sort),
|
|
3239
|
+
tag: "getAll"
|
|
3238
3240
|
};
|
|
3239
3241
|
if (createdBy) {
|
|
3240
3242
|
try {
|
|
@@ -3256,30 +3258,11 @@ function useEnrollmentRepo() {
|
|
|
3256
3258
|
query.schoolYear = schoolYear;
|
|
3257
3259
|
cacheParams.schoolYear = schoolYear;
|
|
3258
3260
|
}
|
|
3259
|
-
if (
|
|
3260
|
-
query.
|
|
3261
|
-
cacheParams.
|
|
3261
|
+
if (gradeLevel) {
|
|
3262
|
+
query.gradeLevel = gradeLevel;
|
|
3263
|
+
cacheParams.gradeLevel = gradeLevel;
|
|
3262
3264
|
}
|
|
3263
3265
|
sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
|
|
3264
|
-
if (search) {
|
|
3265
|
-
query.$or = [
|
|
3266
|
-
{ "learnerInfo.firstName": { $regex: search, $options: "i" } },
|
|
3267
|
-
{ "learnerInfo.lastName": { $regex: search, $options: "i" } },
|
|
3268
|
-
{ "learnerInfo.lrn": { $regex: search, $options: "i" } },
|
|
3269
|
-
{ schoolYear: { $regex: search, $options: "i" } },
|
|
3270
|
-
{ gradeLevelToEnroll: { $regex: search, $options: "i" } }
|
|
3271
|
-
];
|
|
3272
|
-
}
|
|
3273
|
-
if (search)
|
|
3274
|
-
cacheParams.search = search;
|
|
3275
|
-
if (status !== "active")
|
|
3276
|
-
cacheParams.status = status;
|
|
3277
|
-
if (school)
|
|
3278
|
-
cacheParams.school = school;
|
|
3279
|
-
if (schoolYear)
|
|
3280
|
-
cacheParams.schoolYear = schoolYear;
|
|
3281
|
-
if (gradeLevelToEnroll)
|
|
3282
|
-
cacheParams.gradeLevelToEnroll = gradeLevelToEnroll;
|
|
3283
3266
|
const cacheKey = (0, import_nodejs_utils9.makeCacheKey)(namespace_collection, cacheParams);
|
|
3284
3267
|
import_nodejs_utils9.logger.log({
|
|
3285
3268
|
level: "info",
|
|
@@ -35275,7 +35258,8 @@ function useEnrollmentController() {
|
|
|
35275
35258
|
school: import_joi16.default.string().hex().optional().allow("", null),
|
|
35276
35259
|
schoolYear: import_joi16.default.string().optional().allow("", null),
|
|
35277
35260
|
gradeLevelToEnroll: import_joi16.default.string().optional().allow("", null),
|
|
35278
|
-
createdBy: import_joi16.default.string().hex().optional().allow("", null)
|
|
35261
|
+
createdBy: import_joi16.default.string().hex().optional().allow("", null),
|
|
35262
|
+
gradeLevel: import_joi16.default.string().optional().allow("", null)
|
|
35279
35263
|
});
|
|
35280
35264
|
const { error } = validation.validate(query);
|
|
35281
35265
|
if (error) {
|
|
@@ -35288,6 +35272,7 @@ function useEnrollmentController() {
|
|
|
35288
35272
|
const sort = req.query.sort ? String(req.query.sort).split(",") : "";
|
|
35289
35273
|
const sortOrder = req.query.sortOrder ? String(req.query.sortOrder).split(",") : "";
|
|
35290
35274
|
const createdBy = req.query.createdBy ?? "";
|
|
35275
|
+
const gradeLevel = req.query.gradeLevel ?? "";
|
|
35291
35276
|
const sortObj = {};
|
|
35292
35277
|
if (sort && sort.length > 0 && sortOrder && sortOrder.length > 0 && sort.length === sortOrder.length) {
|
|
35293
35278
|
for (let i = 0; i < sort.length; i++) {
|
|
@@ -35304,8 +35289,8 @@ function useEnrollmentController() {
|
|
|
35304
35289
|
status: req.query.status,
|
|
35305
35290
|
school: req.query.school,
|
|
35306
35291
|
schoolYear: req.query.schoolYear,
|
|
35307
|
-
|
|
35308
|
-
|
|
35292
|
+
createdBy,
|
|
35293
|
+
gradeLevel
|
|
35309
35294
|
});
|
|
35310
35295
|
res.json(result);
|
|
35311
35296
|
return;
|