@7365admin1/core 2.28.0 → 2.29.0
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.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2970,10 +2970,12 @@ function useUserRepo() {
|
|
|
2970
2970
|
async function updateUserFieldById({ _id, field, value } = {}, session) {
|
|
2971
2971
|
const allowedFields = [
|
|
2972
2972
|
"name",
|
|
2973
|
-
"gender",
|
|
2974
2973
|
"email",
|
|
2975
2974
|
"contact",
|
|
2975
|
+
"nric",
|
|
2976
|
+
"dateOfBirth",
|
|
2976
2977
|
"profile",
|
|
2978
|
+
"gender",
|
|
2977
2979
|
"defaultOrg"
|
|
2978
2980
|
];
|
|
2979
2981
|
if (!allowedFields.includes(field)) {
|
|
@@ -6690,7 +6692,7 @@ function useUserController() {
|
|
|
6690
6692
|
async function updateUserFieldById(req, res, next) {
|
|
6691
6693
|
const validation = import_joi13.default.object({
|
|
6692
6694
|
_id: import_joi13.default.string().hex().required(),
|
|
6693
|
-
field: import_joi13.default.string().valid("name", "
|
|
6695
|
+
field: import_joi13.default.string().valid("name", "email", "contact", "nric", "dateOfBirth", "profile", "gender", "defaultOrg").required(),
|
|
6694
6696
|
value: import_joi13.default.when("field", {
|
|
6695
6697
|
switch: [
|
|
6696
6698
|
{ is: "email", then: import_joi13.default.string().email().required() },
|
|
@@ -34038,7 +34040,7 @@ function useOccurrenceBookRepo() {
|
|
|
34038
34040
|
date = "",
|
|
34039
34041
|
status = ""
|
|
34040
34042
|
}, session) {
|
|
34041
|
-
page = page > 0 ? page - 1 : 0;
|
|
34043
|
+
page = page > 0 && !date ? page - 1 : 0;
|
|
34042
34044
|
const _site = (0, import_node_server_utils156.toObjectId)(site);
|
|
34043
34045
|
const query = {
|
|
34044
34046
|
site: _site,
|
|
@@ -34063,7 +34065,7 @@ function useOccurrenceBookRepo() {
|
|
|
34063
34065
|
throw new import_node_server_utils156.BadRequestError("Invalid date format. Use DD/MM/YYYY.");
|
|
34064
34066
|
if (day > 31 || month > 12)
|
|
34065
34067
|
throw new import_node_server_utils156.BadRequestError("Invalid date value.");
|
|
34066
|
-
dateObj = new Date(Date.UTC(year, month - 1, day));
|
|
34068
|
+
dateObj = new Date(Date.UTC(year, month - 1, day - 1));
|
|
34067
34069
|
} else {
|
|
34068
34070
|
dateObj = new Date(date);
|
|
34069
34071
|
}
|
|
@@ -37452,12 +37454,15 @@ function useIncidentReportRepo() {
|
|
|
37452
37454
|
}
|
|
37453
37455
|
if (dateFrom) {
|
|
37454
37456
|
const [year, month, day] = dateFrom.split("-").map(Number);
|
|
37455
|
-
const
|
|
37456
|
-
const
|
|
37457
|
+
const offset = 8;
|
|
37458
|
+
const start = new Date(Date.UTC(year, month - 1, day, -offset, 0, 0, 0));
|
|
37459
|
+
const end = new Date(
|
|
37460
|
+
Date.UTC(year, month - 1, day, 23 - offset, 59, 59, 999)
|
|
37461
|
+
);
|
|
37457
37462
|
dateExpr = {
|
|
37458
37463
|
"incidentInformation.incidentTypeAndTime.dateOfIncident": {
|
|
37459
|
-
$gte: start,
|
|
37460
|
-
$lte: end
|
|
37464
|
+
$gte: start.toISOString(),
|
|
37465
|
+
$lte: end.toISOString()
|
|
37461
37466
|
}
|
|
37462
37467
|
};
|
|
37463
37468
|
}
|