@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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f941c74: Program screening - Remove return value check in getById
8
+
9
+ ## 1.9.2
10
+
11
+ ### Patch Changes
12
+
13
+ - d156fe7: Revise get all query
14
+
3
15
  ## 1.9.1
4
16
 
5
17
  ### Patch Changes
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, gradeLevelToEnroll, createdBy, }?: {
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;
@@ -1653,7 +1653,7 @@ declare function useProgramScreeningRepo(): {
1653
1653
  deleteById: (_id: string | ObjectId) => Promise<string>;
1654
1654
  updateById: (_id: string | ObjectId, value: Pick<TProgramScreening, "specialProgram" | "specialProgramName" | "status">) => Promise<string>;
1655
1655
  updateStatusByApplicantId: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
1656
- getByApplicantId: (_id: string | ObjectId) => Promise<TProgramScreening>;
1656
+ getByApplicantId: (_id: string | ObjectId) => Promise<TProgramScreening | null>;
1657
1657
  };
1658
1658
 
1659
1659
  declare function useProgramScreeningController(): {
package/dist/index.js CHANGED
@@ -3224,17 +3224,19 @@ function useEnrollmentRepo() {
3224
3224
  status = "active",
3225
3225
  school = "",
3226
3226
  schoolYear = "",
3227
- gradeLevelToEnroll = "",
3228
- createdBy = ""
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 (gradeLevelToEnroll) {
3260
- query.gradeLevelToEnroll = gradeLevelToEnroll;
3261
- cacheParams.gradeLevelToEnroll = gradeLevelToEnroll;
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",
@@ -4421,9 +4404,6 @@ function useProgramScreeningRepo() {
4421
4404
  applicant: _id,
4422
4405
  status: { $ne: "deleted" }
4423
4406
  });
4424
- if (!result) {
4425
- throw new import_nodejs_utils15.BadRequestError("Program screening not found.");
4426
- }
4427
4407
  setCache(cacheKey, result, 300).then(() => {
4428
4408
  import_nodejs_utils15.logger.log({
4429
4409
  level: "info",
@@ -35275,7 +35255,8 @@ function useEnrollmentController() {
35275
35255
  school: import_joi16.default.string().hex().optional().allow("", null),
35276
35256
  schoolYear: import_joi16.default.string().optional().allow("", null),
35277
35257
  gradeLevelToEnroll: import_joi16.default.string().optional().allow("", null),
35278
- createdBy: import_joi16.default.string().hex().optional().allow("", null)
35258
+ createdBy: import_joi16.default.string().hex().optional().allow("", null),
35259
+ gradeLevel: import_joi16.default.string().optional().allow("", null)
35279
35260
  });
35280
35261
  const { error } = validation.validate(query);
35281
35262
  if (error) {
@@ -35288,6 +35269,7 @@ function useEnrollmentController() {
35288
35269
  const sort = req.query.sort ? String(req.query.sort).split(",") : "";
35289
35270
  const sortOrder = req.query.sortOrder ? String(req.query.sortOrder).split(",") : "";
35290
35271
  const createdBy = req.query.createdBy ?? "";
35272
+ const gradeLevel = req.query.gradeLevel ?? "";
35291
35273
  const sortObj = {};
35292
35274
  if (sort && sort.length > 0 && sortOrder && sortOrder.length > 0 && sort.length === sortOrder.length) {
35293
35275
  for (let i = 0; i < sort.length; i++) {
@@ -35304,8 +35286,8 @@ function useEnrollmentController() {
35304
35286
  status: req.query.status,
35305
35287
  school: req.query.school,
35306
35288
  schoolYear: req.query.schoolYear,
35307
- gradeLevelToEnroll: req.query.gradeLevelToEnroll,
35308
- createdBy
35289
+ createdBy,
35290
+ gradeLevel
35309
35291
  });
35310
35292
  res.json(result);
35311
35293
  return;