@eeplatform/basic-edu 1.9.1 → 1.9.3

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/dist/index.mjs CHANGED
@@ -3140,17 +3140,19 @@ function useEnrollmentRepo() {
3140
3140
  status = "active",
3141
3141
  school = "",
3142
3142
  schoolYear = "",
3143
- gradeLevelToEnroll = "",
3144
- createdBy = ""
3143
+ createdBy = "",
3144
+ gradeLevel = ""
3145
3145
  } = {}) {
3146
3146
  page = page > 0 ? page - 1 : 0;
3147
3147
  const query = {
3148
3148
  status
3149
3149
  };
3150
3150
  const cacheParams = {
3151
+ status,
3151
3152
  page,
3152
3153
  limit,
3153
- sort: JSON.stringify(sort)
3154
+ sort: JSON.stringify(sort),
3155
+ tag: "getAll"
3154
3156
  };
3155
3157
  if (createdBy) {
3156
3158
  try {
@@ -3172,30 +3174,11 @@ function useEnrollmentRepo() {
3172
3174
  query.schoolYear = schoolYear;
3173
3175
  cacheParams.schoolYear = schoolYear;
3174
3176
  }
3175
- if (gradeLevelToEnroll) {
3176
- query.gradeLevelToEnroll = gradeLevelToEnroll;
3177
- cacheParams.gradeLevelToEnroll = gradeLevelToEnroll;
3177
+ if (gradeLevel) {
3178
+ query.gradeLevel = gradeLevel;
3179
+ cacheParams.gradeLevel = gradeLevel;
3178
3180
  }
3179
3181
  sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
3180
- if (search) {
3181
- query.$or = [
3182
- { "learnerInfo.firstName": { $regex: search, $options: "i" } },
3183
- { "learnerInfo.lastName": { $regex: search, $options: "i" } },
3184
- { "learnerInfo.lrn": { $regex: search, $options: "i" } },
3185
- { schoolYear: { $regex: search, $options: "i" } },
3186
- { gradeLevelToEnroll: { $regex: search, $options: "i" } }
3187
- ];
3188
- }
3189
- if (search)
3190
- cacheParams.search = search;
3191
- if (status !== "active")
3192
- cacheParams.status = status;
3193
- if (school)
3194
- cacheParams.school = school;
3195
- if (schoolYear)
3196
- cacheParams.schoolYear = schoolYear;
3197
- if (gradeLevelToEnroll)
3198
- cacheParams.gradeLevelToEnroll = gradeLevelToEnroll;
3199
3182
  const cacheKey = makeCacheKey3(namespace_collection, cacheParams);
3200
3183
  logger8.log({
3201
3184
  level: "info",
@@ -4368,9 +4351,6 @@ function useProgramScreeningRepo() {
4368
4351
  applicant: _id,
4369
4352
  status: { $ne: "deleted" }
4370
4353
  });
4371
- if (!result) {
4372
- throw new BadRequestError14("Program screening not found.");
4373
- }
4374
4354
  setCache(cacheKey, result, 300).then(() => {
4375
4355
  logger11.log({
4376
4356
  level: "info",
@@ -35245,7 +35225,8 @@ function useEnrollmentController() {
35245
35225
  school: Joi16.string().hex().optional().allow("", null),
35246
35226
  schoolYear: Joi16.string().optional().allow("", null),
35247
35227
  gradeLevelToEnroll: Joi16.string().optional().allow("", null),
35248
- createdBy: Joi16.string().hex().optional().allow("", null)
35228
+ createdBy: Joi16.string().hex().optional().allow("", null),
35229
+ gradeLevel: Joi16.string().optional().allow("", null)
35249
35230
  });
35250
35231
  const { error } = validation.validate(query);
35251
35232
  if (error) {
@@ -35258,6 +35239,7 @@ function useEnrollmentController() {
35258
35239
  const sort = req.query.sort ? String(req.query.sort).split(",") : "";
35259
35240
  const sortOrder = req.query.sortOrder ? String(req.query.sortOrder).split(",") : "";
35260
35241
  const createdBy = req.query.createdBy ?? "";
35242
+ const gradeLevel = req.query.gradeLevel ?? "";
35261
35243
  const sortObj = {};
35262
35244
  if (sort && sort.length > 0 && sortOrder && sortOrder.length > 0 && sort.length === sortOrder.length) {
35263
35245
  for (let i = 0; i < sort.length; i++) {
@@ -35274,8 +35256,8 @@ function useEnrollmentController() {
35274
35256
  status: req.query.status,
35275
35257
  school: req.query.school,
35276
35258
  schoolYear: req.query.schoolYear,
35277
- gradeLevelToEnroll: req.query.gradeLevelToEnroll,
35278
- createdBy
35259
+ createdBy,
35260
+ gradeLevel
35279
35261
  });
35280
35262
  res.json(result);
35281
35263
  return;