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