@eeplatform/basic-edu 1.8.1 → 1.8.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/dist/index.mjs CHANGED
@@ -2875,7 +2875,7 @@ var learnerInfoSchema = Joi5.object({
2875
2875
  });
2876
2876
  var schemaUpdateStatus = Joi5.object({
2877
2877
  _id: Joi5.string().hex().length(24).required(),
2878
- status: Joi5.string().valid("accepted", "rejected").required()
2878
+ status: Joi5.string().valid("pending", "accepted", "rejected").required()
2879
2879
  });
2880
2880
  var gradeLevels = [
2881
2881
  "K1",
@@ -3409,12 +3409,12 @@ function useEnrollmentRepo() {
3409
3409
 
3410
3410
  // src/resources/enrollment/enrollment.service.ts
3411
3411
  import {
3412
- AppError as AppError9,
3412
+ AppError as AppError10,
3413
3413
  BadRequestError as BadRequestError19,
3414
3414
  InternalServerError as InternalServerError7,
3415
3415
  logger as logger13,
3416
3416
  NotFoundError,
3417
- useAtlas as useAtlas9
3417
+ useAtlas as useAtlas10
3418
3418
  } from "@eeplatform/nodejs-utils";
3419
3419
 
3420
3420
  // src/resources/learner/learner.repository.ts
@@ -4384,7 +4384,8 @@ function useProgramScreeningRepo() {
4384
4384
  "description",
4385
4385
  "gradeLevels",
4386
4386
  "isDefault",
4387
- "schoolName"
4387
+ "schoolName",
4388
+ "status"
4388
4389
  ];
4389
4390
  if (!allowedFields.includes(field)) {
4390
4391
  throw new BadRequestError14(
@@ -4467,6 +4468,61 @@ function useProgramScreeningRepo() {
4467
4468
  // src/resources/program-screening/program.screening.controller.ts
4468
4469
  import { BadRequestError as BadRequestError15 } from "@eeplatform/nodejs-utils";
4469
4470
  import Joi11 from "joi";
4471
+
4472
+ // src/resources/program-screening/program.screening.service.ts
4473
+ import { AppError as AppError8, useAtlas as useAtlas8 } from "@eeplatform/nodejs-utils";
4474
+ function useProgramScreeningService() {
4475
+ const {
4476
+ updateStatusById: updateEnrollmentStatusById,
4477
+ getById: getEnrollmentById
4478
+ } = useEnrollmentRepo();
4479
+ const { updateFieldById, getById: getProgramScreeningById } = useProgramScreeningRepo();
4480
+ async function updateStatusById(id, status) {
4481
+ const session = useAtlas8.getClient()?.startSession();
4482
+ try {
4483
+ await session?.startTransaction();
4484
+ const application = await getProgramScreeningById(id);
4485
+ if (!application) {
4486
+ throw new AppError8("Application not found", 404);
4487
+ }
4488
+ if (application.status !== "pending") {
4489
+ throw new AppError8("Only pending applications can be updated", 400);
4490
+ }
4491
+ await updateFieldById(
4492
+ { _id: id, field: "status", value: status },
4493
+ session
4494
+ );
4495
+ let enrollmentStatus = "pending";
4496
+ if (status === "passed") {
4497
+ enrollmentStatus = "pending";
4498
+ }
4499
+ if (status === "failed") {
4500
+ enrollmentStatus = "failed-screening";
4501
+ }
4502
+ await updateEnrollmentStatusById(
4503
+ application.applicant,
4504
+ enrollmentStatus,
4505
+ session
4506
+ );
4507
+ await session?.commitTransaction();
4508
+ return "Status updated successfully";
4509
+ } catch (error) {
4510
+ await session?.abortTransaction();
4511
+ if (error instanceof AppError8) {
4512
+ throw error;
4513
+ } else {
4514
+ throw new AppError8("Failed to update status", 500);
4515
+ }
4516
+ } finally {
4517
+ await session?.endSession();
4518
+ }
4519
+ }
4520
+ return {
4521
+ updateStatusById
4522
+ };
4523
+ }
4524
+
4525
+ // src/resources/program-screening/program.screening.controller.ts
4470
4526
  function useProgramScreeningController() {
4471
4527
  const {
4472
4528
  add: _add,
@@ -4477,6 +4533,7 @@ function useProgramScreeningController() {
4477
4533
  deleteById: _deleteById,
4478
4534
  updateById: _updateById
4479
4535
  } = useProgramScreeningRepo();
4536
+ const { updateStatusById: _updateStatusById } = useProgramScreeningService();
4480
4537
  async function add(req, res, next) {
4481
4538
  const value = req.body;
4482
4539
  const { error } = schemaProgramScreening.validate(value);
@@ -4659,6 +4716,30 @@ function useProgramScreeningController() {
4659
4716
  next(error2);
4660
4717
  }
4661
4718
  }
4719
+ async function updateStatusById(req, res, next) {
4720
+ const id = req.params.id;
4721
+ const validation = Joi11.string().hex().required();
4722
+ const { error } = validation.validate(id);
4723
+ if (error) {
4724
+ next(new BadRequestError15(error.message));
4725
+ return;
4726
+ }
4727
+ const value = req.body;
4728
+ const { error: updatePayloadError } = Joi11.object({
4729
+ status: Joi11.string().valid("passed", "failed").required()
4730
+ }).validate(value);
4731
+ if (updatePayloadError) {
4732
+ next(new BadRequestError15(updatePayloadError.message));
4733
+ return;
4734
+ }
4735
+ try {
4736
+ const message = await _updateStatusById(id, value.status);
4737
+ res.json({ message });
4738
+ return;
4739
+ } catch (error2) {
4740
+ next(error2);
4741
+ }
4742
+ }
4662
4743
  return {
4663
4744
  add,
4664
4745
  getAll,
@@ -4666,7 +4747,8 @@ function useProgramScreeningController() {
4666
4747
  getByCode,
4667
4748
  updateField,
4668
4749
  deleteById,
4669
- updateById
4750
+ updateById,
4751
+ updateStatusById
4670
4752
  };
4671
4753
  }
4672
4754
 
@@ -4745,18 +4827,18 @@ function modelProgram(value) {
4745
4827
 
4746
4828
  // src/resources/program/program.repository.ts
4747
4829
  import {
4748
- AppError as AppError8,
4830
+ AppError as AppError9,
4749
4831
  BadRequestError as BadRequestError17,
4750
4832
  InternalServerError as InternalServerError6,
4751
4833
  logger as logger12,
4752
4834
  makeCacheKey as makeCacheKey7,
4753
4835
  paginate as paginate6,
4754
- useAtlas as useAtlas8,
4836
+ useAtlas as useAtlas9,
4755
4837
  useCache as useCache7
4756
4838
  } from "@eeplatform/nodejs-utils";
4757
4839
  import { ObjectId as ObjectId12 } from "mongodb";
4758
4840
  function useProgramRepo() {
4759
- const db = useAtlas8.getDb();
4841
+ const db = useAtlas9.getDb();
4760
4842
  if (!db) {
4761
4843
  throw new Error("Unable to connect to server.");
4762
4844
  }
@@ -4810,7 +4892,7 @@ function useProgramRepo() {
4810
4892
  level: "error",
4811
4893
  message: error.message
4812
4894
  });
4813
- if (error instanceof AppError8) {
4895
+ if (error instanceof AppError9) {
4814
4896
  throw error;
4815
4897
  } else {
4816
4898
  const isDuplicated = error.message.includes("duplicate");
@@ -4933,7 +5015,7 @@ function useProgramRepo() {
4933
5015
  });
4934
5016
  return result;
4935
5017
  } catch (error) {
4936
- if (error instanceof AppError8) {
5018
+ if (error instanceof AppError9) {
4937
5019
  throw error;
4938
5020
  } else {
4939
5021
  throw new InternalServerError6("Failed to get program.");
@@ -4980,7 +5062,7 @@ function useProgramRepo() {
4980
5062
  });
4981
5063
  return result;
4982
5064
  } catch (error) {
4983
- if (error instanceof AppError8) {
5065
+ if (error instanceof AppError9) {
4984
5066
  throw error;
4985
5067
  } else {
4986
5068
  throw new InternalServerError6("Failed to get program.");
@@ -5280,7 +5362,7 @@ function useEnrollmentService() {
5280
5362
  const { add: addProgramScreening } = useProgramScreeningRepo();
5281
5363
  const { getById: getProgramById } = useProgramRepo();
5282
5364
  async function add(value) {
5283
- const session = useAtlas9.getClient()?.startSession();
5365
+ const session = useAtlas10.getClient()?.startSession();
5284
5366
  try {
5285
5367
  session?.startTransaction();
5286
5368
  const applicantInfo = await _getByApplicantInfo({
@@ -5385,7 +5467,7 @@ function useEnrollmentService() {
5385
5467
  if (error) {
5386
5468
  throw new BadRequestError19(error.message);
5387
5469
  }
5388
- const client = useAtlas9.getClient();
5470
+ const client = useAtlas10.getClient();
5389
5471
  if (!client) {
5390
5472
  throw new InternalServerError7("Database client not available");
5391
5473
  }
@@ -5438,7 +5520,31 @@ function useEnrollmentService() {
5438
5520
  } catch (error2) {
5439
5521
  logger13.info(`Enrollment Service: ${error2.message}`);
5440
5522
  await session.abortTransaction();
5441
- if (error2 instanceof AppError9) {
5523
+ if (error2 instanceof AppError10) {
5524
+ throw error2;
5525
+ } else {
5526
+ throw new InternalServerError7("Failed to retrieve enrollment");
5527
+ }
5528
+ }
5529
+ }
5530
+ async function updateStatusWithId(_id, status) {
5531
+ const { error } = schemaUpdateStatus.validate({ _id, status });
5532
+ if (error) {
5533
+ throw new BadRequestError19(error.message);
5534
+ }
5535
+ try {
5536
+ const enrollment = await _getById(_id);
5537
+ if (!enrollment) {
5538
+ throw new NotFoundError("Enrollment not found.");
5539
+ }
5540
+ if (enrollment.status == "pending") {
5541
+ throw new BadRequestError19("Applicant enrollment is already pending.");
5542
+ }
5543
+ await _updateStatusById(_id, status);
5544
+ return "Successfully updated enrollment status";
5545
+ } catch (error2) {
5546
+ logger13.info(`Enrollment Service: ${error2.message}`);
5547
+ if (error2 instanceof AppError10) {
5442
5548
  throw error2;
5443
5549
  } else {
5444
5550
  throw new InternalServerError7("Failed to retrieve enrollment");
@@ -5447,7 +5553,8 @@ function useEnrollmentService() {
5447
5553
  }
5448
5554
  return {
5449
5555
  add,
5450
- updateStatusById
5556
+ updateStatusById,
5557
+ updateStatusWithId
5451
5558
  };
5452
5559
  }
5453
5560
 
@@ -5455,7 +5562,11 @@ function useEnrollmentService() {
5455
5562
  import { BadRequestError as BadRequestError20, logger as logger14 } from "@eeplatform/nodejs-utils";
5456
5563
  import Joi14 from "joi";
5457
5564
  function useEnrollmentController() {
5458
- const { add: _add, updateStatusById: _updateStatusById } = useEnrollmentService();
5565
+ const {
5566
+ add: _add,
5567
+ updateStatusById: _updateStatusById,
5568
+ updateStatusWithId: _updateStatusWithId
5569
+ } = useEnrollmentService();
5459
5570
  const { getAll: _getAll } = useEnrollmentRepo();
5460
5571
  async function add(req, res, next) {
5461
5572
  const value = req.body;
@@ -5526,7 +5637,8 @@ function useEnrollmentController() {
5526
5637
  const status = req.params.status;
5527
5638
  const { error } = schemaUpdateStatus.validate({ _id, status });
5528
5639
  if (error) {
5529
- throw new BadRequestError20(error.message);
5640
+ next(new BadRequestError20(error.message));
5641
+ return;
5530
5642
  }
5531
5643
  try {
5532
5644
  const message = await _updateStatusById(_id, status);
@@ -5536,10 +5648,27 @@ function useEnrollmentController() {
5536
5648
  next(error2);
5537
5649
  }
5538
5650
  }
5651
+ async function updateStatusWithId(req, res, next) {
5652
+ const _id = req.params.id;
5653
+ const status = req.body.status;
5654
+ const { error } = schemaUpdateStatus.validate({ _id, status });
5655
+ if (error) {
5656
+ next(new BadRequestError20(error.message));
5657
+ return;
5658
+ }
5659
+ try {
5660
+ const message = await _updateStatusWithId(_id, status);
5661
+ res.json({ message });
5662
+ return;
5663
+ } catch (error2) {
5664
+ next(error2);
5665
+ }
5666
+ }
5539
5667
  return {
5540
5668
  add,
5541
5669
  getAll,
5542
- updateStatusById
5670
+ updateStatusById,
5671
+ updateStatusWithId
5543
5672
  };
5544
5673
  }
5545
5674
 
@@ -5616,18 +5745,18 @@ function MGradeLevel(value) {
5616
5745
 
5617
5746
  // src/resources/grade-level/grade-level.repository.ts
5618
5747
  import {
5619
- AppError as AppError10,
5748
+ AppError as AppError11,
5620
5749
  BadRequestError as BadRequestError22,
5621
5750
  InternalServerError as InternalServerError8,
5622
5751
  logger as logger16,
5623
5752
  makeCacheKey as makeCacheKey8,
5624
5753
  paginate as paginate7,
5625
- useAtlas as useAtlas10,
5754
+ useAtlas as useAtlas11,
5626
5755
  useCache as useCache8
5627
5756
  } from "@eeplatform/nodejs-utils";
5628
5757
  import { ObjectId as ObjectId14 } from "mongodb";
5629
5758
  function useGradeLevelRepo() {
5630
- const db = useAtlas10.getDb();
5759
+ const db = useAtlas11.getDb();
5631
5760
  if (!db) {
5632
5761
  throw new Error("Unable to connect to server.");
5633
5762
  }
@@ -5664,7 +5793,7 @@ function useGradeLevelRepo() {
5664
5793
  level: "error",
5665
5794
  message: error.message
5666
5795
  });
5667
- if (error instanceof AppError10) {
5796
+ if (error instanceof AppError11) {
5668
5797
  throw error;
5669
5798
  } else {
5670
5799
  const isDuplicated = error.message.includes("duplicate");
@@ -5703,7 +5832,7 @@ function useGradeLevelRepo() {
5703
5832
  level: "error",
5704
5833
  message: error.message
5705
5834
  });
5706
- if (error instanceof AppError10) {
5835
+ if (error instanceof AppError11) {
5707
5836
  throw error;
5708
5837
  } else {
5709
5838
  const isDuplicated = error.message.includes("duplicate");
@@ -5862,7 +5991,7 @@ function useGradeLevelRepo() {
5862
5991
  });
5863
5992
  return gradeLevel;
5864
5993
  } catch (error) {
5865
- if (error instanceof AppError10) {
5994
+ if (error instanceof AppError11) {
5866
5995
  throw error;
5867
5996
  } else {
5868
5997
  throw new InternalServerError8("Failed to get grade level.");
@@ -5888,7 +6017,7 @@ function useGradeLevelRepo() {
5888
6017
  level: "error",
5889
6018
  message: error.message
5890
6019
  });
5891
- if (error instanceof AppError10) {
6020
+ if (error instanceof AppError11) {
5892
6021
  throw error;
5893
6022
  } else {
5894
6023
  throw new InternalServerError8("Failed to delete grade level.");
@@ -6236,18 +6365,18 @@ function modelRegion(value) {
6236
6365
 
6237
6366
  // src/resources/region/region.repository.ts
6238
6367
  import {
6239
- AppError as AppError11,
6368
+ AppError as AppError12,
6240
6369
  BadRequestError as BadRequestError25,
6241
6370
  InternalServerError as InternalServerError9,
6242
6371
  logger as logger18,
6243
6372
  makeCacheKey as makeCacheKey9,
6244
6373
  paginate as paginate8,
6245
- useAtlas as useAtlas11,
6374
+ useAtlas as useAtlas12,
6246
6375
  useCache as useCache9
6247
6376
  } from "@eeplatform/nodejs-utils";
6248
6377
  import { ObjectId as ObjectId16 } from "mongodb";
6249
6378
  function useRegionRepo() {
6250
- const db = useAtlas11.getDb();
6379
+ const db = useAtlas12.getDb();
6251
6380
  if (!db) {
6252
6381
  throw new Error("Unable to connect to server.");
6253
6382
  }
@@ -6290,7 +6419,7 @@ function useRegionRepo() {
6290
6419
  level: "error",
6291
6420
  message: error.message
6292
6421
  });
6293
- if (error instanceof AppError11) {
6422
+ if (error instanceof AppError12) {
6294
6423
  throw error;
6295
6424
  } else {
6296
6425
  const isDuplicated = error.message.includes("duplicate");
@@ -6399,7 +6528,7 @@ function useRegionRepo() {
6399
6528
  });
6400
6529
  return result;
6401
6530
  } catch (error) {
6402
- if (error instanceof AppError11) {
6531
+ if (error instanceof AppError12) {
6403
6532
  throw error;
6404
6533
  } else {
6405
6534
  throw new InternalServerError9("Failed to get region.");
@@ -6437,7 +6566,7 @@ function useRegionRepo() {
6437
6566
  });
6438
6567
  return result;
6439
6568
  } catch (error) {
6440
- if (error instanceof AppError11) {
6569
+ if (error instanceof AppError12) {
6441
6570
  throw error;
6442
6571
  } else {
6443
6572
  throw new InternalServerError9("Failed to get region.");
@@ -6717,18 +6846,18 @@ function modelDivision(value) {
6717
6846
 
6718
6847
  // src/resources/division/division.repository.ts
6719
6848
  import {
6720
- AppError as AppError12,
6849
+ AppError as AppError13,
6721
6850
  BadRequestError as BadRequestError28,
6722
6851
  InternalServerError as InternalServerError10,
6723
6852
  logger as logger19,
6724
6853
  makeCacheKey as makeCacheKey10,
6725
6854
  paginate as paginate9,
6726
- useAtlas as useAtlas12,
6855
+ useAtlas as useAtlas13,
6727
6856
  useCache as useCache10
6728
6857
  } from "@eeplatform/nodejs-utils";
6729
6858
  import { ObjectId as ObjectId18 } from "mongodb";
6730
6859
  function useDivisionRepo() {
6731
- const db = useAtlas12.getDb();
6860
+ const db = useAtlas13.getDb();
6732
6861
  if (!db) {
6733
6862
  throw new Error("Unable to connect to server.");
6734
6863
  }
@@ -6775,7 +6904,7 @@ function useDivisionRepo() {
6775
6904
  level: "error",
6776
6905
  message: error.message
6777
6906
  });
6778
- if (error instanceof AppError12) {
6907
+ if (error instanceof AppError13) {
6779
6908
  throw error;
6780
6909
  } else {
6781
6910
  const isDuplicated = error.message.includes("duplicate");
@@ -6896,7 +7025,7 @@ function useDivisionRepo() {
6896
7025
  });
6897
7026
  return result;
6898
7027
  } catch (error) {
6899
- if (error instanceof AppError12) {
7028
+ if (error instanceof AppError13) {
6900
7029
  throw error;
6901
7030
  } else {
6902
7031
  throw new InternalServerError10("Failed to get division.");
@@ -6934,7 +7063,7 @@ function useDivisionRepo() {
6934
7063
  });
6935
7064
  return result;
6936
7065
  } catch (error) {
6937
- if (error instanceof AppError12) {
7066
+ if (error instanceof AppError13) {
6938
7067
  throw error;
6939
7068
  } else {
6940
7069
  throw new InternalServerError10("Failed to get division.");
@@ -7023,7 +7152,7 @@ function useDivisionRepo() {
7023
7152
  }
7024
7153
 
7025
7154
  // src/resources/division/division.service.ts
7026
- import { useAtlas as useAtlas15 } from "@eeplatform/nodejs-utils";
7155
+ import { useAtlas as useAtlas16 } from "@eeplatform/nodejs-utils";
7027
7156
  import { useRoleRepo as useRoleRepo2 } from "@eeplatform/core";
7028
7157
 
7029
7158
  // src/resources/school/school.model.ts
@@ -7133,18 +7262,18 @@ function modelSchool(value) {
7133
7262
 
7134
7263
  // src/resources/school/school.repository.ts
7135
7264
  import {
7136
- AppError as AppError13,
7265
+ AppError as AppError14,
7137
7266
  BadRequestError as BadRequestError30,
7138
7267
  InternalServerError as InternalServerError11,
7139
7268
  logger as logger20,
7140
7269
  makeCacheKey as makeCacheKey11,
7141
7270
  paginate as paginate10,
7142
- useAtlas as useAtlas13,
7271
+ useAtlas as useAtlas14,
7143
7272
  useCache as useCache11
7144
7273
  } from "@eeplatform/nodejs-utils";
7145
7274
  import { ObjectId as ObjectId20 } from "mongodb";
7146
7275
  function useSchoolRepo() {
7147
- const db = useAtlas13.getDb();
7276
+ const db = useAtlas14.getDb();
7148
7277
  if (!db) {
7149
7278
  throw new Error("Unable to connect to server.");
7150
7279
  }
@@ -7197,7 +7326,7 @@ function useSchoolRepo() {
7197
7326
  transactionNumber: error.errorResponse?.txnNumber || "unknown"
7198
7327
  }
7199
7328
  });
7200
- if (error instanceof AppError13) {
7329
+ if (error instanceof AppError14) {
7201
7330
  throw error;
7202
7331
  } else {
7203
7332
  const isDuplicated = error.message.includes("duplicate");
@@ -7317,7 +7446,7 @@ function useSchoolRepo() {
7317
7446
  });
7318
7447
  return result;
7319
7448
  } catch (error) {
7320
- if (error instanceof AppError13) {
7449
+ if (error instanceof AppError14) {
7321
7450
  throw error;
7322
7451
  } else {
7323
7452
  throw new InternalServerError11("Failed to get school.");
@@ -7360,7 +7489,7 @@ function useSchoolRepo() {
7360
7489
  });
7361
7490
  return result;
7362
7491
  } catch (error) {
7363
- if (error instanceof AppError13) {
7492
+ if (error instanceof AppError14) {
7364
7493
  throw error;
7365
7494
  } else {
7366
7495
  throw new InternalServerError11("Failed to get school.");
@@ -7398,7 +7527,7 @@ function useSchoolRepo() {
7398
7527
  });
7399
7528
  return result;
7400
7529
  } catch (error) {
7401
- if (error instanceof AppError13) {
7530
+ if (error instanceof AppError14) {
7402
7531
  throw error;
7403
7532
  } else {
7404
7533
  throw new InternalServerError11("Failed to get school.");
@@ -7420,7 +7549,7 @@ function useSchoolRepo() {
7420
7549
  delCachedData();
7421
7550
  return `Successfully updated school status to ${status}.`;
7422
7551
  } catch (error) {
7423
- if (error instanceof AppError13) {
7552
+ if (error instanceof AppError14) {
7424
7553
  throw error;
7425
7554
  } else {
7426
7555
  throw new InternalServerError11("Failed to update school status.");
@@ -7533,7 +7662,7 @@ function useSchoolRepo() {
7533
7662
  }
7534
7663
 
7535
7664
  // src/resources/school/school.service.ts
7536
- import { BadRequestError as BadRequestError31, useAtlas as useAtlas14, logger as logger21 } from "@eeplatform/nodejs-utils";
7665
+ import { BadRequestError as BadRequestError31, useAtlas as useAtlas15, logger as logger21 } from "@eeplatform/nodejs-utils";
7537
7666
  import {
7538
7667
  useRoleRepo,
7539
7668
  useUserRepo,
@@ -35734,7 +35863,7 @@ function useSchoolService() {
35734
35863
  if (!school) {
35735
35864
  throw new BadRequestError31("School registration not found.");
35736
35865
  }
35737
- const session = useAtlas14.getClient()?.startSession();
35866
+ const session = useAtlas15.getClient()?.startSession();
35738
35867
  if (!session) {
35739
35868
  throw new Error("Unable to start session for school service.");
35740
35869
  }
@@ -35792,7 +35921,7 @@ function useSchoolService() {
35792
35921
  if (error) {
35793
35922
  throw new BadRequestError31(error.message);
35794
35923
  }
35795
- const session = useAtlas14.getClient()?.startSession();
35924
+ const session = useAtlas15.getClient()?.startSession();
35796
35925
  if (!session) {
35797
35926
  throw new Error("Unable to start session for school service.");
35798
35927
  }
@@ -35933,7 +36062,7 @@ ${errors.slice(0, 5).join("\n")}${errors.length > 5 ? `
35933
36062
  };
35934
36063
  const { getByName: getPSGCByName } = usePSGCRepo();
35935
36064
  for (let i = 0; i < schools.length; i++) {
35936
- const session = useAtlas14.getClient()?.startSession();
36065
+ const session = useAtlas15.getClient()?.startSession();
35937
36066
  if (!session) {
35938
36067
  throw new Error("Unable to start MongoDB session");
35939
36068
  }
@@ -36285,7 +36414,7 @@ function useDivisionService() {
36285
36414
  const { addRole } = useRoleRepo2();
36286
36415
  const { updateDivisionNameByDivision } = useSchoolRepo();
36287
36416
  async function add(value) {
36288
- const session = useAtlas15.getClient()?.startSession();
36417
+ const session = useAtlas16.getClient()?.startSession();
36289
36418
  if (!session) {
36290
36419
  throw new Error("Unable to start session for division service.");
36291
36420
  }
@@ -36313,7 +36442,7 @@ function useDivisionService() {
36313
36442
  }
36314
36443
  }
36315
36444
  async function updateById(id, value) {
36316
- const session = useAtlas15.getClient()?.startSession();
36445
+ const session = useAtlas16.getClient()?.startSession();
36317
36446
  if (!session) {
36318
36447
  throw new Error("Unable to start session for division service.");
36319
36448
  }
@@ -36610,12 +36739,12 @@ import {
36610
36739
  logger as logger22,
36611
36740
  makeCacheKey as makeCacheKey12,
36612
36741
  paginate as paginate11,
36613
- useAtlas as useAtlas16,
36742
+ useAtlas as useAtlas17,
36614
36743
  useCache as useCache12
36615
36744
  } from "@eeplatform/nodejs-utils";
36616
36745
  import { ObjectId as ObjectId22 } from "mongodb";
36617
36746
  function useAssetRepo() {
36618
- const db = useAtlas16.getDb();
36747
+ const db = useAtlas17.getDb();
36619
36748
  if (!db) {
36620
36749
  throw new BadRequestError35("Unable to connect to server.");
36621
36750
  }
@@ -37242,12 +37371,12 @@ import {
37242
37371
  logger as logger23,
37243
37372
  makeCacheKey as makeCacheKey13,
37244
37373
  paginate as paginate12,
37245
- useAtlas as useAtlas17,
37374
+ useAtlas as useAtlas18,
37246
37375
  useCache as useCache13
37247
37376
  } from "@eeplatform/nodejs-utils";
37248
37377
  import { ObjectId as ObjectId24 } from "mongodb";
37249
37378
  function useStockCardRepository() {
37250
- const db = useAtlas17.getDb();
37379
+ const db = useAtlas18.getDb();
37251
37380
  if (!db) {
37252
37381
  throw new BadRequestError38("Unable to connect to server.");
37253
37382
  }
@@ -37454,13 +37583,13 @@ function useStockCardRepository() {
37454
37583
  import {
37455
37584
  BadRequestError as BadRequestError39,
37456
37585
  NotFoundError as NotFoundError2,
37457
- useAtlas as useAtlas18
37586
+ useAtlas as useAtlas19
37458
37587
  } from "@eeplatform/nodejs-utils";
37459
37588
  function useStockCardService() {
37460
37589
  const { add: _add, getById: _getById } = useStockCardRepository();
37461
37590
  const { getById: _getAssetById, updateById: updateAssetById } = useAssetRepo();
37462
37591
  async function add(data) {
37463
- const session = useAtlas18.getClient()?.startSession();
37592
+ const session = useAtlas19.getClient()?.startSession();
37464
37593
  if (!session) {
37465
37594
  throw new BadRequestError39("Unable to start database session.");
37466
37595
  }
@@ -37655,18 +37784,18 @@ function MPlantilla(data) {
37655
37784
 
37656
37785
  // src/resources/plantilla/plantilla.repository.ts
37657
37786
  import {
37658
- AppError as AppError14,
37787
+ AppError as AppError15,
37659
37788
  BadRequestError as BadRequestError42,
37660
37789
  InternalServerError as InternalServerError12,
37661
37790
  logger as logger24,
37662
37791
  makeCacheKey as makeCacheKey14,
37663
37792
  paginate as paginate13,
37664
- useAtlas as useAtlas19,
37793
+ useAtlas as useAtlas20,
37665
37794
  useCache as useCache14
37666
37795
  } from "@eeplatform/nodejs-utils";
37667
37796
  import { ObjectId as ObjectId26 } from "mongodb";
37668
37797
  function usePlantillaRepo() {
37669
- const db = useAtlas19.getDb();
37798
+ const db = useAtlas20.getDb();
37670
37799
  if (!db) {
37671
37800
  throw new Error("Unable to connect to server.");
37672
37801
  }
@@ -37697,7 +37826,7 @@ function usePlantillaRepo() {
37697
37826
  level: "error",
37698
37827
  message: error.message
37699
37828
  });
37700
- if (error instanceof AppError14) {
37829
+ if (error instanceof AppError15) {
37701
37830
  throw error;
37702
37831
  } else {
37703
37832
  const isDuplicated = error.message.includes("duplicate");
@@ -37728,7 +37857,7 @@ function usePlantillaRepo() {
37728
37857
  level: "error",
37729
37858
  message: error.message
37730
37859
  });
37731
- if (error instanceof AppError14) {
37860
+ if (error instanceof AppError15) {
37732
37861
  throw error;
37733
37862
  } else {
37734
37863
  throw new Error("Failed to update plantilla.");
@@ -37840,7 +37969,7 @@ function usePlantillaRepo() {
37840
37969
  });
37841
37970
  return result;
37842
37971
  } catch (error) {
37843
- if (error instanceof AppError14) {
37972
+ if (error instanceof AppError15) {
37844
37973
  throw error;
37845
37974
  } else {
37846
37975
  throw new InternalServerError12("Failed to get plantilla.");
@@ -37865,7 +37994,7 @@ function usePlantillaRepo() {
37865
37994
  level: "error",
37866
37995
  message: error.message
37867
37996
  });
37868
- if (error instanceof AppError14) {
37997
+ if (error instanceof AppError15) {
37869
37998
  throw error;
37870
37999
  } else {
37871
38000
  throw new InternalServerError12("Failed to delete plantilla.");
@@ -37897,7 +38026,7 @@ function usePlantillaRepo() {
37897
38026
  }
37898
38027
 
37899
38028
  // src/resources/plantilla/plantilla.service.ts
37900
- import { BadRequestError as BadRequestError43, useAtlas as useAtlas20, logger as logger25 } from "@eeplatform/nodejs-utils";
38029
+ import { BadRequestError as BadRequestError43, useAtlas as useAtlas21, logger as logger25 } from "@eeplatform/nodejs-utils";
37901
38030
  var Papa2 = __toESM(require_papaparse());
37902
38031
  function usePlantillaService() {
37903
38032
  const { add: addPlantilla, delCachedData } = usePlantillaRepo();
@@ -38053,7 +38182,7 @@ ${errors.slice(0, 10).join("\n")}${errors.length > 10 ? `
38053
38182
  }
38054
38183
  throw new BadRequestError43(`File processing error: ${error.message}`);
38055
38184
  }
38056
- const session = useAtlas20.getClient()?.startSession();
38185
+ const session = useAtlas21.getClient()?.startSession();
38057
38186
  if (!session) {
38058
38187
  throw new Error("Unable to start session for bulk plantilla upload.");
38059
38188
  }
@@ -38344,18 +38473,18 @@ function modelSectionPreset(value) {
38344
38473
 
38345
38474
  // src/resources/section-preset/section.preset.repository.ts
38346
38475
  import {
38347
- AppError as AppError15,
38476
+ AppError as AppError16,
38348
38477
  BadRequestError as BadRequestError46,
38349
38478
  InternalServerError as InternalServerError13,
38350
38479
  logger as logger26,
38351
38480
  makeCacheKey as makeCacheKey15,
38352
38481
  paginate as paginate14,
38353
- useAtlas as useAtlas21,
38482
+ useAtlas as useAtlas22,
38354
38483
  useCache as useCache15
38355
38484
  } from "@eeplatform/nodejs-utils";
38356
38485
  import { ObjectId as ObjectId28 } from "mongodb";
38357
38486
  function useSectionPresetRepo() {
38358
- const db = useAtlas21.getDb();
38487
+ const db = useAtlas22.getDb();
38359
38488
  if (!db) {
38360
38489
  throw new Error("Unable to connect to server.");
38361
38490
  }
@@ -38403,7 +38532,7 @@ function useSectionPresetRepo() {
38403
38532
  level: "error",
38404
38533
  message: error.message
38405
38534
  });
38406
- if (error instanceof AppError15) {
38535
+ if (error instanceof AppError16) {
38407
38536
  throw error;
38408
38537
  } else {
38409
38538
  const isDuplicated = error.message.includes("duplicate");
@@ -38530,7 +38659,7 @@ function useSectionPresetRepo() {
38530
38659
  });
38531
38660
  return result;
38532
38661
  } catch (error) {
38533
- if (error instanceof AppError15) {
38662
+ if (error instanceof AppError16) {
38534
38663
  throw error;
38535
38664
  } else {
38536
38665
  throw new InternalServerError13("Failed to get section preset.");
@@ -38568,7 +38697,7 @@ function useSectionPresetRepo() {
38568
38697
  });
38569
38698
  return result;
38570
38699
  } catch (error) {
38571
- if (error instanceof AppError15) {
38700
+ if (error instanceof AppError16) {
38572
38701
  throw error;
38573
38702
  } else {
38574
38703
  throw new InternalServerError13("Failed to get section preset.");
@@ -38864,18 +38993,18 @@ function modelSection(value) {
38864
38993
 
38865
38994
  // src/resources/section/section.repository.ts
38866
38995
  import {
38867
- AppError as AppError16,
38996
+ AppError as AppError17,
38868
38997
  BadRequestError as BadRequestError49,
38869
38998
  InternalServerError as InternalServerError14,
38870
38999
  logger as logger27,
38871
39000
  makeCacheKey as makeCacheKey16,
38872
39001
  paginate as paginate15,
38873
- useAtlas as useAtlas22,
39002
+ useAtlas as useAtlas23,
38874
39003
  useCache as useCache16
38875
39004
  } from "@eeplatform/nodejs-utils";
38876
39005
  import { ObjectId as ObjectId30 } from "mongodb";
38877
39006
  function useSectionRepo() {
38878
- const db = useAtlas22.getDb();
39007
+ const db = useAtlas23.getDb();
38879
39008
  if (!db) {
38880
39009
  throw new Error("Unable to connect to server.");
38881
39010
  }
@@ -38926,7 +39055,7 @@ function useSectionRepo() {
38926
39055
  level: "error",
38927
39056
  message: error.message
38928
39057
  });
38929
- if (error instanceof AppError16) {
39058
+ if (error instanceof AppError17) {
38930
39059
  throw error;
38931
39060
  } else {
38932
39061
  const isDuplicated = error.message.includes("duplicate");
@@ -39054,7 +39183,7 @@ function useSectionRepo() {
39054
39183
  });
39055
39184
  return result;
39056
39185
  } catch (error) {
39057
- if (error instanceof AppError16) {
39186
+ if (error instanceof AppError17) {
39058
39187
  throw error;
39059
39188
  } else {
39060
39189
  throw new InternalServerError14("Failed to get section.");
@@ -39092,7 +39221,7 @@ function useSectionRepo() {
39092
39221
  });
39093
39222
  return result;
39094
39223
  } catch (error) {
39095
- if (error instanceof AppError16) {
39224
+ if (error instanceof AppError17) {
39096
39225
  throw error;
39097
39226
  } else {
39098
39227
  throw new InternalServerError14("Failed to get section.");
@@ -39134,7 +39263,7 @@ function useSectionRepo() {
39134
39263
  });
39135
39264
  return result;
39136
39265
  } catch (error) {
39137
- if (error instanceof AppError16) {
39266
+ if (error instanceof AppError17) {
39138
39267
  throw error;
39139
39268
  } else {
39140
39269
  throw new InternalServerError14("Failed to get sections by school.");
@@ -39259,21 +39388,21 @@ import Joi43 from "joi";
39259
39388
 
39260
39389
  // src/resources/section/section.service.ts
39261
39390
  import {
39262
- AppError as AppError24,
39391
+ AppError as AppError25,
39263
39392
  BadRequestError as BadRequestError64,
39264
39393
  InternalServerError as InternalServerError21,
39265
- useAtlas as useAtlas29
39394
+ useAtlas as useAtlas30
39266
39395
  } from "@eeplatform/nodejs-utils";
39267
39396
 
39268
39397
  // src/resources/section-student/section.student.repository.ts
39269
39398
  import {
39270
- AppError as AppError17,
39399
+ AppError as AppError18,
39271
39400
  BadRequestError as BadRequestError51,
39272
39401
  InternalServerError as InternalServerError15,
39273
39402
  logger as logger28,
39274
39403
  makeCacheKey as makeCacheKey17,
39275
39404
  paginate as paginate16,
39276
- useAtlas as useAtlas23,
39405
+ useAtlas as useAtlas24,
39277
39406
  useCache as useCache17
39278
39407
  } from "@eeplatform/nodejs-utils";
39279
39408
 
@@ -39349,7 +39478,7 @@ function modelSectionStudent(value) {
39349
39478
  import { ObjectId as ObjectId32 } from "mongodb";
39350
39479
  import Joi33 from "joi";
39351
39480
  function useSectionStudentRepo() {
39352
- const db = useAtlas23.getDb();
39481
+ const db = useAtlas24.getDb();
39353
39482
  if (!db) {
39354
39483
  throw new Error("Unable to connect to server.");
39355
39484
  }
@@ -39400,7 +39529,7 @@ function useSectionStudentRepo() {
39400
39529
  level: "error",
39401
39530
  message: error.message
39402
39531
  });
39403
- if (error instanceof AppError17) {
39532
+ if (error instanceof AppError18) {
39404
39533
  throw error;
39405
39534
  } else {
39406
39535
  const isDuplicated = error.message.includes("duplicate");
@@ -39616,18 +39745,18 @@ function modelSectionSubject(value) {
39616
39745
 
39617
39746
  // src/resources/section-subject/section.subject.repository.ts
39618
39747
  import {
39619
- AppError as AppError18,
39748
+ AppError as AppError19,
39620
39749
  BadRequestError as BadRequestError53,
39621
39750
  InternalServerError as InternalServerError16,
39622
39751
  logger as logger29,
39623
39752
  makeCacheKey as makeCacheKey18,
39624
39753
  paginate as paginate17,
39625
- useAtlas as useAtlas24,
39754
+ useAtlas as useAtlas25,
39626
39755
  useCache as useCache18
39627
39756
  } from "@eeplatform/nodejs-utils";
39628
39757
  import { ObjectId as ObjectId34 } from "mongodb";
39629
39758
  function useSectionSubjectRepo() {
39630
- const db = useAtlas24.getDb();
39759
+ const db = useAtlas25.getDb();
39631
39760
  if (!db) {
39632
39761
  throw new Error("Unable to connect to server.");
39633
39762
  }
@@ -39691,7 +39820,7 @@ function useSectionSubjectRepo() {
39691
39820
  level: "error",
39692
39821
  message: error.message
39693
39822
  });
39694
- if (error instanceof AppError18) {
39823
+ if (error instanceof AppError19) {
39695
39824
  throw error;
39696
39825
  } else {
39697
39826
  const isDuplicated = error.message.includes("duplicate");
@@ -39845,7 +39974,7 @@ function useSectionSubjectRepo() {
39845
39974
  });
39846
39975
  return result;
39847
39976
  } catch (error) {
39848
- if (error instanceof AppError18) {
39977
+ if (error instanceof AppError19) {
39849
39978
  throw error;
39850
39979
  } else {
39851
39980
  throw new InternalServerError16("Failed to get section subject.");
@@ -39887,7 +40016,7 @@ function useSectionSubjectRepo() {
39887
40016
  });
39888
40017
  return result;
39889
40018
  } catch (error) {
39890
- if (error instanceof AppError18) {
40019
+ if (error instanceof AppError19) {
39891
40020
  throw error;
39892
40021
  } else {
39893
40022
  throw new InternalServerError16(
@@ -39931,7 +40060,7 @@ function useSectionSubjectRepo() {
39931
40060
  });
39932
40061
  return result;
39933
40062
  } catch (error) {
39934
- if (error instanceof AppError18) {
40063
+ if (error instanceof AppError19) {
39935
40064
  throw error;
39936
40065
  } else {
39937
40066
  throw new InternalServerError16(
@@ -39975,7 +40104,7 @@ function useSectionSubjectRepo() {
39975
40104
  });
39976
40105
  return result;
39977
40106
  } catch (error) {
39978
- if (error instanceof AppError18) {
40107
+ if (error instanceof AppError19) {
39979
40108
  throw error;
39980
40109
  } else {
39981
40110
  throw new InternalServerError16(
@@ -40094,7 +40223,7 @@ function useSectionSubjectRepo() {
40094
40223
  }
40095
40224
 
40096
40225
  // src/resources/section-subject/section.subject.service.ts
40097
- import { AppError as AppError19, InternalServerError as InternalServerError17 } from "@eeplatform/nodejs-utils";
40226
+ import { AppError as AppError20, InternalServerError as InternalServerError17 } from "@eeplatform/nodejs-utils";
40098
40227
  function useSectionSubjectService() {
40099
40228
  const { getById: getSchoolById } = useSchoolRepo();
40100
40229
  const { add: _add } = useSectionSubjectRepo();
@@ -40115,7 +40244,7 @@ function useSectionSubjectService() {
40115
40244
  await _add(value);
40116
40245
  return "Successfully created section subject.";
40117
40246
  } catch (error2) {
40118
- if (error2 instanceof AppError19) {
40247
+ if (error2 instanceof AppError20) {
40119
40248
  throw error2;
40120
40249
  } else {
40121
40250
  throw new InternalServerError17("Failed to create section subject.");
@@ -40439,19 +40568,19 @@ function modelTeachingLoad(value) {
40439
40568
 
40440
40569
  // src/resources/teaching-load/teaching.load.repository.ts
40441
40570
  import {
40442
- AppError as AppError20,
40571
+ AppError as AppError21,
40443
40572
  BadRequestError as BadRequestError56,
40444
40573
  InternalServerError as InternalServerError18,
40445
40574
  logger as logger31,
40446
40575
  makeCacheKey as makeCacheKey19,
40447
40576
  paginate as paginate18,
40448
- useAtlas as useAtlas25,
40577
+ useAtlas as useAtlas26,
40449
40578
  useCache as useCache19
40450
40579
  } from "@eeplatform/nodejs-utils";
40451
40580
  import { ObjectId as ObjectId36 } from "mongodb";
40452
40581
  import Joi37 from "joi";
40453
40582
  function useTeachingLoadRepo() {
40454
- const db = useAtlas25.getDb();
40583
+ const db = useAtlas26.getDb();
40455
40584
  if (!db) {
40456
40585
  throw new Error("Unable to connect to server.");
40457
40586
  }
@@ -40490,7 +40619,7 @@ function useTeachingLoadRepo() {
40490
40619
  level: "error",
40491
40620
  message: error.message
40492
40621
  });
40493
- if (error instanceof AppError20) {
40622
+ if (error instanceof AppError21) {
40494
40623
  throw error;
40495
40624
  } else {
40496
40625
  throw new Error("Failed to create teaching load.");
@@ -40523,7 +40652,7 @@ function useTeachingLoadRepo() {
40523
40652
  level: "error",
40524
40653
  message: error.message
40525
40654
  });
40526
- if (error instanceof AppError20) {
40655
+ if (error instanceof AppError21) {
40527
40656
  throw error;
40528
40657
  } else {
40529
40658
  throw new Error("Failed to update teaching load.");
@@ -40665,7 +40794,7 @@ function useTeachingLoadRepo() {
40665
40794
  });
40666
40795
  return result;
40667
40796
  } catch (error) {
40668
- if (error instanceof AppError20) {
40797
+ if (error instanceof AppError21) {
40669
40798
  throw error;
40670
40799
  } else {
40671
40800
  throw new InternalServerError18("Failed to get teaching load.");
@@ -40691,7 +40820,7 @@ function useTeachingLoadRepo() {
40691
40820
  level: "error",
40692
40821
  message: error.message
40693
40822
  });
40694
- if (error instanceof AppError20) {
40823
+ if (error instanceof AppError21) {
40695
40824
  throw error;
40696
40825
  } else {
40697
40826
  throw new InternalServerError18("Failed to delete teaching load.");
@@ -40738,7 +40867,7 @@ function useTeachingLoadRepo() {
40738
40867
  });
40739
40868
  return result;
40740
40869
  } catch (error) {
40741
- if (error instanceof AppError20) {
40870
+ if (error instanceof AppError21) {
40742
40871
  throw error;
40743
40872
  } else {
40744
40873
  throw new InternalServerError18(
@@ -41067,18 +41196,18 @@ function modelTeachingLoadSlot(value) {
41067
41196
 
41068
41197
  // src/resources/teaching-load/teaching.load.slot.repository.ts
41069
41198
  import {
41070
- AppError as AppError21,
41199
+ AppError as AppError22,
41071
41200
  BadRequestError as BadRequestError59,
41072
41201
  InternalServerError as InternalServerError19,
41073
41202
  logger as logger34,
41074
41203
  makeCacheKey as makeCacheKey20,
41075
41204
  paginate as paginate19,
41076
- useAtlas as useAtlas26,
41205
+ useAtlas as useAtlas27,
41077
41206
  useCache as useCache20
41078
41207
  } from "@eeplatform/nodejs-utils";
41079
41208
  import { ObjectId as ObjectId38 } from "mongodb";
41080
41209
  function useTeachingLoadSlotRepo() {
41081
- const db = useAtlas26.getDb();
41210
+ const db = useAtlas27.getDb();
41082
41211
  if (!db) {
41083
41212
  throw new Error("Unable to connect to server.");
41084
41213
  }
@@ -41118,7 +41247,7 @@ function useTeachingLoadSlotRepo() {
41118
41247
  level: "error",
41119
41248
  message: error.message
41120
41249
  });
41121
- if (error instanceof AppError21) {
41250
+ if (error instanceof AppError22) {
41122
41251
  throw error;
41123
41252
  } else {
41124
41253
  throw new Error("Failed to create teaching load slot.");
@@ -41158,7 +41287,7 @@ function useTeachingLoadSlotRepo() {
41158
41287
  level: "error",
41159
41288
  message: error.message
41160
41289
  });
41161
- if (error instanceof AppError21) {
41290
+ if (error instanceof AppError22) {
41162
41291
  throw error;
41163
41292
  } else {
41164
41293
  throw new Error("Failed to update teaching load slot.");
@@ -41306,7 +41435,7 @@ function useTeachingLoadSlotRepo() {
41306
41435
  });
41307
41436
  return result;
41308
41437
  } catch (error) {
41309
- if (error instanceof AppError21) {
41438
+ if (error instanceof AppError22) {
41310
41439
  throw error;
41311
41440
  } else {
41312
41441
  throw new InternalServerError19("Failed to get teaching load slot.");
@@ -41332,7 +41461,7 @@ function useTeachingLoadSlotRepo() {
41332
41461
  level: "error",
41333
41462
  message: error.message
41334
41463
  });
41335
- if (error instanceof AppError21) {
41464
+ if (error instanceof AppError22) {
41336
41465
  throw error;
41337
41466
  } else {
41338
41467
  throw new InternalServerError19("Failed to delete teaching load slot.");
@@ -41368,11 +41497,11 @@ import { BadRequestError as BadRequestError60, logger as logger35 } from "@eepla
41368
41497
  import Joi40 from "joi";
41369
41498
 
41370
41499
  // src/resources/teaching-load/teaching.load.slot.service.ts
41371
- import { AppError as AppError22, useAtlas as useAtlas27 } from "@eeplatform/nodejs-utils";
41500
+ import { AppError as AppError23, useAtlas as useAtlas28 } from "@eeplatform/nodejs-utils";
41372
41501
  function useTeachingLoadSlotService() {
41373
41502
  const { add: addSlot } = useTeachingLoadSlotRepo();
41374
41503
  async function add(value) {
41375
- const session = useAtlas27.getClient()?.startSession();
41504
+ const session = useAtlas28.getClient()?.startSession();
41376
41505
  if (!session) {
41377
41506
  throw new Error("Unable to start database session.");
41378
41507
  }
@@ -41386,7 +41515,7 @@ function useTeachingLoadSlotService() {
41386
41515
  return "Successfully added teaching load slots.";
41387
41516
  } catch (error) {
41388
41517
  await session.abortTransaction();
41389
- if (error instanceof AppError22) {
41518
+ if (error instanceof AppError23) {
41390
41519
  throw error;
41391
41520
  } else {
41392
41521
  throw new Error("Failed to create teaching load slots.");
@@ -41730,18 +41859,18 @@ function MPersonnel(value) {
41730
41859
 
41731
41860
  // src/resources/personnel/personnel.repository.ts
41732
41861
  import {
41733
- AppError as AppError23,
41862
+ AppError as AppError24,
41734
41863
  BadRequestError as BadRequestError62,
41735
41864
  InternalServerError as InternalServerError20,
41736
41865
  logger as logger37,
41737
41866
  makeCacheKey as makeCacheKey21,
41738
41867
  paginate as paginate20,
41739
- useAtlas as useAtlas28,
41868
+ useAtlas as useAtlas29,
41740
41869
  useCache as useCache21
41741
41870
  } from "@eeplatform/nodejs-utils";
41742
41871
  import { ObjectId as ObjectId40 } from "mongodb";
41743
41872
  function usePersonnelRepo() {
41744
- const db = useAtlas28.getDb();
41873
+ const db = useAtlas29.getDb();
41745
41874
  if (!db) {
41746
41875
  throw new Error("Unable to connect to server.");
41747
41876
  }
@@ -41779,7 +41908,7 @@ function usePersonnelRepo() {
41779
41908
  level: "error",
41780
41909
  message: error.message
41781
41910
  });
41782
- if (error instanceof AppError23) {
41911
+ if (error instanceof AppError24) {
41783
41912
  throw error;
41784
41913
  } else {
41785
41914
  throw new Error("Failed to create personnel.");
@@ -41805,7 +41934,7 @@ function usePersonnelRepo() {
41805
41934
  level: "error",
41806
41935
  message: error.message
41807
41936
  });
41808
- if (error instanceof AppError23) {
41937
+ if (error instanceof AppError24) {
41809
41938
  throw error;
41810
41939
  } else {
41811
41940
  throw new Error("Failed to update personnel.");
@@ -41913,7 +42042,7 @@ function usePersonnelRepo() {
41913
42042
  });
41914
42043
  return result;
41915
42044
  } catch (error) {
41916
- if (error instanceof AppError23) {
42045
+ if (error instanceof AppError24) {
41917
42046
  throw error;
41918
42047
  } else {
41919
42048
  throw new InternalServerError20("Failed to get personnel.");
@@ -41938,7 +42067,7 @@ function usePersonnelRepo() {
41938
42067
  level: "error",
41939
42068
  message: error.message
41940
42069
  });
41941
- if (error instanceof AppError23) {
42070
+ if (error instanceof AppError24) {
41942
42071
  throw error;
41943
42072
  } else {
41944
42073
  throw new InternalServerError20("Failed to delete personnel.");
@@ -41974,7 +42103,7 @@ function usePersonnelRepo() {
41974
42103
  });
41975
42104
  return result;
41976
42105
  } catch (error) {
41977
- if (error instanceof AppError23) {
42106
+ if (error instanceof AppError24) {
41978
42107
  throw error;
41979
42108
  } else {
41980
42109
  throw new InternalServerError20(
@@ -42277,7 +42406,7 @@ function useSectionService() {
42277
42406
  `Invalid section generation data: ${error.message}`
42278
42407
  );
42279
42408
  }
42280
- const session = useAtlas29.getClient()?.startSession();
42409
+ const session = useAtlas30.getClient()?.startSession();
42281
42410
  if (!session) {
42282
42411
  throw new Error("Unable to start database session.");
42283
42412
  }
@@ -42442,7 +42571,7 @@ function useSectionService() {
42442
42571
  return "Sections generated successfully.";
42443
42572
  } catch (error2) {
42444
42573
  await session.abortTransaction();
42445
- if (error2 instanceof AppError24) {
42574
+ if (error2 instanceof AppError25) {
42446
42575
  throw error2;
42447
42576
  } else {
42448
42577
  throw new InternalServerError21("Failed to generate sections.");
@@ -42905,18 +43034,18 @@ function MBuildingUnit(value) {
42905
43034
 
42906
43035
  // src/resources/building/building.repository.ts
42907
43036
  import {
42908
- AppError as AppError25,
43037
+ AppError as AppError26,
42909
43038
  BadRequestError as BadRequestError68,
42910
43039
  InternalServerError as InternalServerError22,
42911
43040
  logger as logger40,
42912
43041
  makeCacheKey as makeCacheKey22,
42913
43042
  paginate as paginate21,
42914
- useAtlas as useAtlas30,
43043
+ useAtlas as useAtlas31,
42915
43044
  useCache as useCache22
42916
43045
  } from "@eeplatform/nodejs-utils";
42917
43046
  import { ObjectId as ObjectId42 } from "mongodb";
42918
43047
  function useBuildingRepo() {
42919
- const db = useAtlas30.getDb();
43048
+ const db = useAtlas31.getDb();
42920
43049
  if (!db) {
42921
43050
  throw new Error("Unable to connect to server.");
42922
43051
  }
@@ -42945,7 +43074,7 @@ function useBuildingRepo() {
42945
43074
  level: "error",
42946
43075
  message: error.message
42947
43076
  });
42948
- if (error instanceof AppError25) {
43077
+ if (error instanceof AppError26) {
42949
43078
  throw error;
42950
43079
  } else {
42951
43080
  const isDuplicated = error.message.includes("duplicate");
@@ -42975,7 +43104,7 @@ function useBuildingRepo() {
42975
43104
  level: "error",
42976
43105
  message: error.message
42977
43106
  });
42978
- if (error instanceof AppError25) {
43107
+ if (error instanceof AppError26) {
42979
43108
  throw error;
42980
43109
  } else {
42981
43110
  throw new Error("Failed to update building.");
@@ -43087,7 +43216,7 @@ function useBuildingRepo() {
43087
43216
  });
43088
43217
  return result;
43089
43218
  } catch (error) {
43090
- if (error instanceof AppError25) {
43219
+ if (error instanceof AppError26) {
43091
43220
  throw error;
43092
43221
  } else {
43093
43222
  throw new InternalServerError22("Failed to get building.");
@@ -43112,7 +43241,7 @@ function useBuildingRepo() {
43112
43241
  level: "error",
43113
43242
  message: error.message
43114
43243
  });
43115
- if (error instanceof AppError25) {
43244
+ if (error instanceof AppError26) {
43116
43245
  throw error;
43117
43246
  } else {
43118
43247
  throw new InternalServerError22("Failed to delete building.");
@@ -43146,23 +43275,23 @@ function useBuildingRepo() {
43146
43275
  import {
43147
43276
  BadRequestError as BadRequestError70,
43148
43277
  NotFoundError as NotFoundError3,
43149
- useAtlas as useAtlas32
43278
+ useAtlas as useAtlas33
43150
43279
  } from "@eeplatform/nodejs-utils";
43151
43280
 
43152
43281
  // src/resources/building/building-unit.repository.ts
43153
43282
  import {
43154
- AppError as AppError26,
43283
+ AppError as AppError27,
43155
43284
  BadRequestError as BadRequestError69,
43156
43285
  InternalServerError as InternalServerError23,
43157
43286
  logger as logger41,
43158
43287
  makeCacheKey as makeCacheKey23,
43159
43288
  paginate as paginate22,
43160
- useAtlas as useAtlas31,
43289
+ useAtlas as useAtlas32,
43161
43290
  useCache as useCache23
43162
43291
  } from "@eeplatform/nodejs-utils";
43163
43292
  import { ObjectId as ObjectId43 } from "mongodb";
43164
43293
  function useBuildingUnitRepo() {
43165
- const db = useAtlas31.getDb();
43294
+ const db = useAtlas32.getDb();
43166
43295
  if (!db) {
43167
43296
  throw new Error("Unable to connect to server.");
43168
43297
  }
@@ -43218,7 +43347,7 @@ function useBuildingUnitRepo() {
43218
43347
  level: "error",
43219
43348
  message: error.message
43220
43349
  });
43221
- if (error instanceof AppError26) {
43350
+ if (error instanceof AppError27) {
43222
43351
  throw error;
43223
43352
  } else {
43224
43353
  throw new Error("Failed to create building unit.");
@@ -43248,7 +43377,7 @@ function useBuildingUnitRepo() {
43248
43377
  level: "error",
43249
43378
  message: error2.message
43250
43379
  });
43251
- if (error2 instanceof AppError26) {
43380
+ if (error2 instanceof AppError27) {
43252
43381
  throw error2;
43253
43382
  } else {
43254
43383
  throw new Error("Failed to create building unit.");
@@ -43278,7 +43407,7 @@ function useBuildingUnitRepo() {
43278
43407
  level: "error",
43279
43408
  message: error2.message
43280
43409
  });
43281
- if (error2 instanceof AppError26) {
43410
+ if (error2 instanceof AppError27) {
43282
43411
  throw error2;
43283
43412
  } else {
43284
43413
  throw new Error("Failed to update building unit.");
@@ -43430,7 +43559,7 @@ function useBuildingUnitRepo() {
43430
43559
  });
43431
43560
  return result;
43432
43561
  } catch (error) {
43433
- if (error instanceof AppError26) {
43562
+ if (error instanceof AppError27) {
43434
43563
  throw error;
43435
43564
  } else {
43436
43565
  throw new InternalServerError23("Failed to get building unit.");
@@ -43474,7 +43603,7 @@ function useBuildingUnitRepo() {
43474
43603
  });
43475
43604
  return result;
43476
43605
  } catch (error) {
43477
- if (error instanceof AppError26) {
43606
+ if (error instanceof AppError27) {
43478
43607
  throw error;
43479
43608
  } else {
43480
43609
  throw new InternalServerError23("Failed to get building unit.");
@@ -43516,7 +43645,7 @@ function useBuildingUnitRepo() {
43516
43645
  });
43517
43646
  return result;
43518
43647
  } catch (error) {
43519
- if (error instanceof AppError26) {
43648
+ if (error instanceof AppError27) {
43520
43649
  throw error;
43521
43650
  } else {
43522
43651
  throw new InternalServerError23("Failed to get building unit.");
@@ -43542,7 +43671,7 @@ function useBuildingUnitRepo() {
43542
43671
  level: "error",
43543
43672
  message: error.message
43544
43673
  });
43545
- if (error instanceof AppError26) {
43674
+ if (error instanceof AppError27) {
43546
43675
  throw error;
43547
43676
  } else {
43548
43677
  throw new Error("Failed to deleted room/facility.");
@@ -43573,7 +43702,7 @@ function useBuildingService() {
43573
43702
  const { getByBuildingLevel, getByBuilding, updateByBuildingId } = useBuildingUnitRepo();
43574
43703
  async function updateById(id, data) {
43575
43704
  data.levels = Number(data.levels);
43576
- const session = useAtlas32.getClient()?.startSession();
43705
+ const session = useAtlas33.getClient()?.startSession();
43577
43706
  try {
43578
43707
  const building = await _getById(id);
43579
43708
  if (!building) {
@@ -43767,7 +43896,7 @@ function useBuildingController() {
43767
43896
  }
43768
43897
 
43769
43898
  // src/resources/building/building-unit.service.ts
43770
- import { useAtlas as useAtlas33 } from "@eeplatform/nodejs-utils";
43899
+ import { useAtlas as useAtlas34 } from "@eeplatform/nodejs-utils";
43771
43900
  function useBuildingUnitService() {
43772
43901
  const {
43773
43902
  add: _add,
@@ -43775,7 +43904,7 @@ function useBuildingUnitService() {
43775
43904
  deleteById: _deleteById
43776
43905
  } = useBuildingUnitRepo();
43777
43906
  async function add(value) {
43778
- const session = useAtlas33.getClient()?.startSession();
43907
+ const session = useAtlas34.getClient()?.startSession();
43779
43908
  if (!session) {
43780
43909
  throw new Error("Unable to start session for building unit service.");
43781
43910
  }