@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/dist/index.mjs
CHANGED
|
@@ -2577,10 +2577,12 @@ function useUserRepo() {
|
|
|
2577
2577
|
async function updateUserFieldById({ _id, field, value } = {}, session) {
|
|
2578
2578
|
const allowedFields = [
|
|
2579
2579
|
"name",
|
|
2580
|
-
"gender",
|
|
2581
2580
|
"email",
|
|
2582
2581
|
"contact",
|
|
2582
|
+
"nric",
|
|
2583
|
+
"dateOfBirth",
|
|
2583
2584
|
"profile",
|
|
2585
|
+
"gender",
|
|
2584
2586
|
"defaultOrg"
|
|
2585
2587
|
];
|
|
2586
2588
|
if (!allowedFields.includes(field)) {
|
|
@@ -6380,7 +6382,7 @@ function useUserController() {
|
|
|
6380
6382
|
async function updateUserFieldById(req, res, next) {
|
|
6381
6383
|
const validation = Joi13.object({
|
|
6382
6384
|
_id: Joi13.string().hex().required(),
|
|
6383
|
-
field: Joi13.string().valid("name", "
|
|
6385
|
+
field: Joi13.string().valid("name", "email", "contact", "nric", "dateOfBirth", "profile", "gender", "defaultOrg").required(),
|
|
6384
6386
|
value: Joi13.when("field", {
|
|
6385
6387
|
switch: [
|
|
6386
6388
|
{ is: "email", then: Joi13.string().email().required() },
|
|
@@ -34116,7 +34118,7 @@ function useOccurrenceBookRepo() {
|
|
|
34116
34118
|
date = "",
|
|
34117
34119
|
status = ""
|
|
34118
34120
|
}, session) {
|
|
34119
|
-
page = page > 0 ? page - 1 : 0;
|
|
34121
|
+
page = page > 0 && !date ? page - 1 : 0;
|
|
34120
34122
|
const _site = toObjectId12(site);
|
|
34121
34123
|
const query = {
|
|
34122
34124
|
site: _site,
|
|
@@ -34141,7 +34143,7 @@ function useOccurrenceBookRepo() {
|
|
|
34141
34143
|
throw new BadRequestError146("Invalid date format. Use DD/MM/YYYY.");
|
|
34142
34144
|
if (day > 31 || month > 12)
|
|
34143
34145
|
throw new BadRequestError146("Invalid date value.");
|
|
34144
|
-
dateObj = new Date(Date.UTC(year, month - 1, day));
|
|
34146
|
+
dateObj = new Date(Date.UTC(year, month - 1, day - 1));
|
|
34145
34147
|
} else {
|
|
34146
34148
|
dateObj = new Date(date);
|
|
34147
34149
|
}
|
|
@@ -37597,12 +37599,15 @@ function useIncidentReportRepo() {
|
|
|
37597
37599
|
}
|
|
37598
37600
|
if (dateFrom) {
|
|
37599
37601
|
const [year, month, day] = dateFrom.split("-").map(Number);
|
|
37600
|
-
const
|
|
37601
|
-
const
|
|
37602
|
+
const offset = 8;
|
|
37603
|
+
const start = new Date(Date.UTC(year, month - 1, day, -offset, 0, 0, 0));
|
|
37604
|
+
const end = new Date(
|
|
37605
|
+
Date.UTC(year, month - 1, day, 23 - offset, 59, 59, 999)
|
|
37606
|
+
);
|
|
37602
37607
|
dateExpr = {
|
|
37603
37608
|
"incidentInformation.incidentTypeAndTime.dateOfIncident": {
|
|
37604
|
-
$gte: start,
|
|
37605
|
-
$lte: end
|
|
37609
|
+
$gte: start.toISOString(),
|
|
37610
|
+
$lte: end.toISOString()
|
|
37606
37611
|
}
|
|
37607
37612
|
};
|
|
37608
37613
|
}
|