@7365admin1/core 3.32.2-staging.8 → 3.33.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 +6 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +36 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -151
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/.github/workflows/publish-staging.yml +0 -36
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2622,8 +2622,6 @@ type TGetAttendancesQuery = {
|
|
|
2622
2622
|
page?: number;
|
|
2623
2623
|
limit?: number;
|
|
2624
2624
|
search?: string;
|
|
2625
|
-
startDate?: string | Date;
|
|
2626
|
-
endDate?: string | Date;
|
|
2627
2625
|
} & Pick<TAttendance, "site" | "serviceType">;
|
|
2628
2626
|
type TGetAttendancesByUserQuery = Pick<TGetAttendancesQuery, "page" | "limit" | "search" | "site" | "serviceType"> & Pick<TAttendance, "user">;
|
|
2629
2627
|
declare const attendanceSchema: Joi.ObjectSchema<any>;
|
|
@@ -2684,7 +2682,7 @@ declare function useAttendanceSettingsController(): {
|
|
|
2684
2682
|
declare function useAttendanceRepository(): {
|
|
2685
2683
|
createIndex: () => Promise<void>;
|
|
2686
2684
|
checkInAttendance: (value: TAttendanceCheckIn, session?: ClientSession) => Promise<ObjectId>;
|
|
2687
|
-
getAllAttendances: ({ page, limit, search, site,
|
|
2685
|
+
getAllAttendances: ({ page, limit, search, site, serviceType, }: TGetAttendancesQuery) => Promise<{}>;
|
|
2688
2686
|
getAttendanceByUser: ({ page, limit, search, site, serviceType, user, }: TGetAttendancesByUserQuery) => Promise<{}>;
|
|
2689
2687
|
getAttendanceById: (_id: string | ObjectId, session?: ClientSession) => Promise<{}>;
|
|
2690
2688
|
getRawAttendanceById: (_id: string | ObjectId, session?: ClientSession) => Promise<TAttendance>;
|
package/dist/index.js
CHANGED
|
@@ -9207,7 +9207,6 @@ var MAILER_TRANSPORT_PORT = Number(process.env.MAILER_TRANSPORT_PORT) ?? 465;
|
|
|
9207
9207
|
var MAILER_TRANSPORT_SECURE = process.env.MAILER_TRANSPORT_SECURE === "true";
|
|
9208
9208
|
var MAILER_EMAIL = process.env.MAILER_EMAIL ?? "default@gmail.com";
|
|
9209
9209
|
var MAILER_PASSWORD = process.env.MAILER_PASSWORD ?? "password";
|
|
9210
|
-
var MAILER_FROM_EMAIL = process.env.MAILER_FROM_EMAIL || void 0;
|
|
9211
9210
|
var ACCESS_TOKEN_SECRET = process.env.ACCESS_TOKEN_SECRET ?? "access_token_secret";
|
|
9212
9211
|
var REFRESH_TOKEN_SECRET = process.env.REFRESH_TOKEN_SECRET ?? "refresh_token_secret";
|
|
9213
9212
|
var ACCESS_TOKEN_EXPIRY = process.env.ACCESS_TOKEN_EXPIRY ?? "15s";
|
|
@@ -12361,7 +12360,6 @@ function useVerificationService() {
|
|
|
12361
12360
|
port: MAILER_TRANSPORT_PORT,
|
|
12362
12361
|
secure: MAILER_TRANSPORT_SECURE,
|
|
12363
12362
|
email: MAILER_EMAIL,
|
|
12364
|
-
from: MAILER_FROM_EMAIL,
|
|
12365
12363
|
password: MAILER_PASSWORD
|
|
12366
12364
|
};
|
|
12367
12365
|
const mailer = new import_node_server_utils21.useMailer(MailerConfig);
|
|
@@ -27003,8 +27001,7 @@ function useVehicleService() {
|
|
|
27003
27001
|
throw new Error("Unable to start session for vehicle service.");
|
|
27004
27002
|
}
|
|
27005
27003
|
}
|
|
27006
|
-
const
|
|
27007
|
-
const [_vehiclePlateNumber] = plateNumbers;
|
|
27004
|
+
const [_vehiclePlateNumber] = value.plateNumber;
|
|
27008
27005
|
const [existingPlateNumber, org] = await Promise.all([
|
|
27009
27006
|
_getVehicleByPlateNumber(_vehiclePlateNumber),
|
|
27010
27007
|
_getById(value.org)
|
|
@@ -27069,6 +27066,7 @@ function useVehicleService() {
|
|
|
27069
27066
|
}
|
|
27070
27067
|
}
|
|
27071
27068
|
const owner = value.name;
|
|
27069
|
+
const plateNumbers = value.plateNumber;
|
|
27072
27070
|
try {
|
|
27073
27071
|
if (!isExternalSession) {
|
|
27074
27072
|
session.startTransaction();
|
|
@@ -27285,10 +27283,7 @@ function useVehicleService() {
|
|
|
27285
27283
|
const dahuaResponse = await _addPlateNumber(dahuaPayload);
|
|
27286
27284
|
if (dahuaResponse?.statusCode != 200) {
|
|
27287
27285
|
console.log("dahuaResponse", dahuaResponse);
|
|
27288
|
-
console.log(
|
|
27289
|
-
"approveVehicleById dahuaResponse dahuaResponse?.statusCode != 200",
|
|
27290
|
-
dahuaResponse?.statusCode
|
|
27291
|
-
);
|
|
27286
|
+
console.log("approveVehicleById dahuaResponse dahuaResponse?.statusCode != 200", dahuaResponse?.statusCode);
|
|
27292
27287
|
throw new import_node_server_utils78.BadRequestError("Failed to add plate number to ANPR");
|
|
27293
27288
|
}
|
|
27294
27289
|
const responseData = dahuaResponse?.data.toString("utf-8");
|
|
@@ -27495,19 +27490,7 @@ function useVehicleService() {
|
|
|
27495
27490
|
if (value.peopleId) {
|
|
27496
27491
|
value.peopleId = new import_mongodb49.ObjectId(value.peopleId);
|
|
27497
27492
|
}
|
|
27498
|
-
const {
|
|
27499
|
-
name,
|
|
27500
|
-
plateNumber,
|
|
27501
|
-
start,
|
|
27502
|
-
end,
|
|
27503
|
-
recNo,
|
|
27504
|
-
type,
|
|
27505
|
-
unit,
|
|
27506
|
-
site,
|
|
27507
|
-
block,
|
|
27508
|
-
level,
|
|
27509
|
-
...rest
|
|
27510
|
-
} = value;
|
|
27493
|
+
const { name, plateNumber, start, end, recNo, type, unit, site, block, level, ...rest } = value;
|
|
27511
27494
|
if (_name != name || _plateNumber != plateNumber) {
|
|
27512
27495
|
const startDahua = value.start ? formatDahuaDate(new Date(value.start)) : formatDahuaDate(new Date(_start));
|
|
27513
27496
|
const endDahua = value.end ? formatDahuaDate(new Date(value.end)) : formatDahuaDate(new Date(_end));
|
|
@@ -27534,11 +27517,7 @@ function useVehicleService() {
|
|
|
27534
27517
|
for (const camera of siteCameras) {
|
|
27535
27518
|
const { host, username, password } = camera;
|
|
27536
27519
|
if (_plateNumber != plateNumber) {
|
|
27537
|
-
console.log(
|
|
27538
|
-
"updateVehicleById _plateNumber != plateNumber",
|
|
27539
|
-
_plateNumber,
|
|
27540
|
-
plateNumber
|
|
27541
|
-
);
|
|
27520
|
+
console.log("updateVehicleById _plateNumber != plateNumber", _plateNumber, plateNumber);
|
|
27542
27521
|
const removePlateNumber = {
|
|
27543
27522
|
host,
|
|
27544
27523
|
username,
|
|
@@ -27585,11 +27564,7 @@ function useVehicleService() {
|
|
|
27585
27564
|
);
|
|
27586
27565
|
}
|
|
27587
27566
|
} else {
|
|
27588
|
-
console.log(
|
|
27589
|
-
"updateVehicleById _plateNumber == plateNumber",
|
|
27590
|
-
_plateNumber,
|
|
27591
|
-
plateNumber
|
|
27592
|
-
);
|
|
27567
|
+
console.log("updateVehicleById _plateNumber == plateNumber", _plateNumber, plateNumber);
|
|
27593
27568
|
const dahuaPayload = {
|
|
27594
27569
|
host,
|
|
27595
27570
|
username,
|
|
@@ -32979,7 +32954,6 @@ function MAttendance(value) {
|
|
|
32979
32954
|
// src/repositories/attendance.repository.ts
|
|
32980
32955
|
var import_mongodb60 = require("mongodb");
|
|
32981
32956
|
var import_node_server_utils103 = require("@7365admin1/node-server-utils");
|
|
32982
|
-
var import_moment = __toESM(require("moment"));
|
|
32983
32957
|
function useAttendanceRepository() {
|
|
32984
32958
|
const db = import_node_server_utils103.useAtlas.getDb();
|
|
32985
32959
|
if (!db) {
|
|
@@ -33021,8 +32995,6 @@ function useAttendanceRepository() {
|
|
|
33021
32995
|
limit = 10,
|
|
33022
32996
|
search = "",
|
|
33023
32997
|
site,
|
|
33024
|
-
startDate = "",
|
|
33025
|
-
endDate = "",
|
|
33026
32998
|
serviceType
|
|
33027
32999
|
}) {
|
|
33028
33000
|
page = page > 0 ? page - 1 : 0;
|
|
@@ -33042,37 +33014,6 @@ function useAttendanceRepository() {
|
|
|
33042
33014
|
if (search) {
|
|
33043
33015
|
cacheOptions.search = search;
|
|
33044
33016
|
}
|
|
33045
|
-
const singaporeTz = "Asia/Singapore";
|
|
33046
|
-
const normalizedStartDate = typeof startDate === "string" ? startDate : (0, import_moment.default)(startDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
33047
|
-
const normalizedEndDate = typeof endDate === "string" ? endDate : (0, import_moment.default)(endDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
33048
|
-
if (startDate && endDate) {
|
|
33049
|
-
const startOfDay = import_moment.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate();
|
|
33050
|
-
const endOfDay = import_moment.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate();
|
|
33051
|
-
query.$expr = {
|
|
33052
|
-
$and: [
|
|
33053
|
-
{ $gte: [{ $toDate: "$checkIn.timestamp" }, startOfDay] },
|
|
33054
|
-
{ $lte: [{ $toDate: "$checkIn.timestamp" }, endOfDay] }
|
|
33055
|
-
]
|
|
33056
|
-
};
|
|
33057
|
-
cacheOptions.startDate = normalizedStartDate;
|
|
33058
|
-
cacheOptions.endDate = normalizedEndDate;
|
|
33059
|
-
} else if (startDate) {
|
|
33060
|
-
query.$expr = {
|
|
33061
|
-
$gte: [
|
|
33062
|
-
{ $toDate: "$checkIn.timestamp" },
|
|
33063
|
-
import_moment.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate()
|
|
33064
|
-
]
|
|
33065
|
-
};
|
|
33066
|
-
cacheOptions.startDate = normalizedStartDate;
|
|
33067
|
-
} else if (endDate) {
|
|
33068
|
-
query.$expr = {
|
|
33069
|
-
$lte: [
|
|
33070
|
-
{ $toDate: "$checkIn.timestamp" },
|
|
33071
|
-
import_moment.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate()
|
|
33072
|
-
]
|
|
33073
|
-
};
|
|
33074
|
-
cacheOptions.endDate = normalizedEndDate;
|
|
33075
|
-
}
|
|
33076
33017
|
const cacheKey = (0, import_node_server_utils103.makeCacheKey)(namespace_collection, cacheOptions);
|
|
33077
33018
|
const cachedData = await getCache(cacheKey);
|
|
33078
33019
|
if (cachedData) {
|
|
@@ -33574,9 +33515,7 @@ function useAttendanceController() {
|
|
|
33574
33515
|
limit: import_joi56.default.number().min(1).optional().allow("", null),
|
|
33575
33516
|
search: import_joi56.default.string().optional().allow("", null),
|
|
33576
33517
|
site: import_joi56.default.string().hex().required(),
|
|
33577
|
-
serviceType: import_joi56.default.string().valid(...Object.values(AppServiceType)).required()
|
|
33578
|
-
dateFrom: import_joi56.default.alternatives().try(import_joi56.default.date(), import_joi56.default.string()).optional().allow("", null),
|
|
33579
|
-
dateTo: import_joi56.default.alternatives().try(import_joi56.default.date(), import_joi56.default.string()).optional().allow("", null)
|
|
33518
|
+
serviceType: import_joi56.default.string().valid(...Object.values(AppServiceType)).required()
|
|
33580
33519
|
});
|
|
33581
33520
|
const { error } = validation.validate(query);
|
|
33582
33521
|
if (error) {
|
|
@@ -33589,17 +33528,13 @@ function useAttendanceController() {
|
|
|
33589
33528
|
const search = req.query.search ?? "";
|
|
33590
33529
|
const site = req.params.site ?? "";
|
|
33591
33530
|
const serviceType = req.query.serviceType ?? "";
|
|
33592
|
-
const startDate = req.query.dateFrom ?? "";
|
|
33593
|
-
const endDate = req.query.dateTo ?? "";
|
|
33594
33531
|
try {
|
|
33595
33532
|
const data = await _getAllAttendances({
|
|
33596
33533
|
page,
|
|
33597
33534
|
limit,
|
|
33598
33535
|
search,
|
|
33599
33536
|
site,
|
|
33600
|
-
serviceType
|
|
33601
|
-
startDate,
|
|
33602
|
-
endDate
|
|
33537
|
+
serviceType
|
|
33603
33538
|
});
|
|
33604
33539
|
res.json(data);
|
|
33605
33540
|
return;
|
|
@@ -34925,7 +34860,6 @@ function useVisitorTransactionService() {
|
|
|
34925
34860
|
port: MAILER_TRANSPORT_PORT,
|
|
34926
34861
|
secure: MAILER_TRANSPORT_SECURE,
|
|
34927
34862
|
email: MAILER_EMAIL,
|
|
34928
|
-
from: MAILER_FROM_EMAIL,
|
|
34929
34863
|
password: MAILER_PASSWORD
|
|
34930
34864
|
};
|
|
34931
34865
|
const mailer = new import_node_server_utils107.useMailer(MailerConfig);
|
|
@@ -36414,7 +36348,6 @@ function usePersonService() {
|
|
|
36414
36348
|
port: MAILER_TRANSPORT_PORT,
|
|
36415
36349
|
secure: MAILER_TRANSPORT_SECURE,
|
|
36416
36350
|
email: MAILER_EMAIL,
|
|
36417
|
-
from: MAILER_FROM_EMAIL,
|
|
36418
36351
|
password: MAILER_PASSWORD
|
|
36419
36352
|
};
|
|
36420
36353
|
const mailer = new import_node_server_utils112.useMailer(MailerConfig);
|
|
@@ -58767,7 +58700,6 @@ function useNfcPatrolLogController() {
|
|
|
58767
58700
|
const query = {
|
|
58768
58701
|
site: req.query.site,
|
|
58769
58702
|
date: req.query.date,
|
|
58770
|
-
type: req.query.type,
|
|
58771
58703
|
route: {
|
|
58772
58704
|
_id: req.query["route._id"],
|
|
58773
58705
|
startTime: req.query["route.startTime"]
|
|
@@ -58782,14 +58714,13 @@ function useNfcPatrolLogController() {
|
|
|
58782
58714
|
next(new import_node_server_utils200.BadRequestError(messages));
|
|
58783
58715
|
return;
|
|
58784
58716
|
}
|
|
58785
|
-
const { page, limit, site, date,
|
|
58717
|
+
const { page, limit, site, date, route } = value;
|
|
58786
58718
|
try {
|
|
58787
58719
|
const data = await _getAllBySite({
|
|
58788
58720
|
page,
|
|
58789
58721
|
limit,
|
|
58790
58722
|
site,
|
|
58791
58723
|
date,
|
|
58792
|
-
type,
|
|
58793
58724
|
route
|
|
58794
58725
|
});
|
|
58795
58726
|
res.status(200).json(data);
|
|
@@ -58851,7 +58782,7 @@ function useNfcPatrolLogController() {
|
|
|
58851
58782
|
// src/repositories/new-dashboard.repo.ts
|
|
58852
58783
|
var import_node_server_utils201 = require("@7365admin1/node-server-utils");
|
|
58853
58784
|
var import_mongodb122 = require("mongodb");
|
|
58854
|
-
var
|
|
58785
|
+
var import_moment = __toESM(require("moment"));
|
|
58855
58786
|
var Period = /* @__PURE__ */ ((Period2) => {
|
|
58856
58787
|
Period2["TODAY"] = "today";
|
|
58857
58788
|
Period2["THIS_WEEK"] = "thisWeek";
|
|
@@ -58888,7 +58819,7 @@ function useNewDashboardRepo() {
|
|
|
58888
58819
|
const dateWithoutTimezone = date.replace(/\s*\+\d{2}:\d{2}$/, "");
|
|
58889
58820
|
date = new Date(dateWithoutTimezone);
|
|
58890
58821
|
}
|
|
58891
|
-
const singaporeMoment =
|
|
58822
|
+
const singaporeMoment = import_moment.default.tz(date, "Asia/Singapore");
|
|
58892
58823
|
singaporeMoment.set({
|
|
58893
58824
|
hour: 23,
|
|
58894
58825
|
minute: 59,
|
|
@@ -58898,7 +58829,7 @@ function useNewDashboardRepo() {
|
|
|
58898
58829
|
return singaporeMoment.toDate();
|
|
58899
58830
|
}
|
|
58900
58831
|
function getDateRange(p) {
|
|
58901
|
-
const now = (0,
|
|
58832
|
+
const now = (0, import_moment.default)().tz("Asia/Singapore");
|
|
58902
58833
|
if (p === "thisWeek" /* THIS_WEEK */) {
|
|
58903
58834
|
return {
|
|
58904
58835
|
$gte: now.clone().startOf("isoWeek").toDate(),
|
|
@@ -58916,7 +58847,7 @@ function useNewDashboardRepo() {
|
|
|
58916
58847
|
$lte: now.clone().endOf("day").toDate()
|
|
58917
58848
|
};
|
|
58918
58849
|
}
|
|
58919
|
-
function getSiteDayRange(date =
|
|
58850
|
+
function getSiteDayRange(date = import_moment.default.tz("Asia/Singapore")) {
|
|
58920
58851
|
return {
|
|
58921
58852
|
$gte: date.clone().startOf("day").toDate(),
|
|
58922
58853
|
$lte: date.clone().endOf("day").toDate()
|
|
@@ -59187,8 +59118,8 @@ function useNewDashboardRepo() {
|
|
|
59187
59118
|
const todayCompliance = tTotal > 0 ? tCompleted / tTotal * 100 : 0;
|
|
59188
59119
|
let activePatrolItems = [];
|
|
59189
59120
|
if (period === "today" /* TODAY */) {
|
|
59190
|
-
const todayString =
|
|
59191
|
-
const dayIndex =
|
|
59121
|
+
const todayString = import_moment.default.tz("Asia/Singapore").format("YYYY-MM-DD");
|
|
59122
|
+
const dayIndex = import_moment.default.tz("Asia/Singapore").day();
|
|
59192
59123
|
const repeatDay = dayIndex === 0 ? 7 : dayIndex;
|
|
59193
59124
|
const routes = await db.collection("patrol.route").find({
|
|
59194
59125
|
site: { $in: [siteIdObj, siteId] },
|
|
@@ -59240,12 +59171,12 @@ function useNewDashboardRepo() {
|
|
|
59240
59171
|
status = "completed";
|
|
59241
59172
|
}
|
|
59242
59173
|
} else {
|
|
59243
|
-
const routeTime =
|
|
59174
|
+
const routeTime = import_moment.default.tz(
|
|
59244
59175
|
`${todayString} ${startTime}`,
|
|
59245
59176
|
"YYYY-MM-DD HH:mm",
|
|
59246
59177
|
"Asia/Singapore"
|
|
59247
59178
|
);
|
|
59248
|
-
const nowSg =
|
|
59179
|
+
const nowSg = import_moment.default.tz("Asia/Singapore");
|
|
59249
59180
|
const diffMinutes = nowSg.diff(routeTime, "minutes");
|
|
59250
59181
|
if (diffMinutes >= 0) {
|
|
59251
59182
|
if (diffMinutes <= 120) {
|
|
@@ -59293,8 +59224,8 @@ function useNewDashboardRepo() {
|
|
|
59293
59224
|
if (log.status) {
|
|
59294
59225
|
status = Array.isArray(log.status) ? log.status.join(", ") : log.status;
|
|
59295
59226
|
}
|
|
59296
|
-
const logTime = (0,
|
|
59297
|
-
const logDate = (0,
|
|
59227
|
+
const logTime = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("HH:mm");
|
|
59228
|
+
const logDate = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("DD/MM/YYYY");
|
|
59298
59229
|
return {
|
|
59299
59230
|
id: log._id.toString(),
|
|
59300
59231
|
title: log.name,
|
|
@@ -59346,11 +59277,11 @@ function useNewDashboardRepo() {
|
|
|
59346
59277
|
}
|
|
59347
59278
|
async function getPropertyManagementDashboard(siteId, period = "today" /* TODAY */, type, facility) {
|
|
59348
59279
|
const siteIdObj = (0, import_node_server_utils201.toObjectId)(siteId);
|
|
59349
|
-
const startOfToday =
|
|
59350
|
-
const endOfToday =
|
|
59280
|
+
const startOfToday = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
59281
|
+
const endOfToday = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
59351
59282
|
const facilityTodayRange = getSiteDayRange();
|
|
59352
59283
|
const facilityYesterdayRange = getSiteDayRange(
|
|
59353
|
-
|
|
59284
|
+
import_moment.default.tz("Asia/Singapore").subtract(1, "day")
|
|
59354
59285
|
);
|
|
59355
59286
|
const facilityTodayStart = facilityTodayRange.$gte;
|
|
59356
59287
|
const facilityTodayEnd = facilityTodayRange.$lte;
|
|
@@ -59362,13 +59293,13 @@ function useNewDashboardRepo() {
|
|
|
59362
59293
|
};
|
|
59363
59294
|
if (period === "thisWeek" /* THIS_WEEK */) {
|
|
59364
59295
|
facilityPeriodRange = {
|
|
59365
|
-
$gte:
|
|
59366
|
-
$lte:
|
|
59296
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate(),
|
|
59297
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate()
|
|
59367
59298
|
};
|
|
59368
59299
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
59369
59300
|
facilityPeriodRange = {
|
|
59370
|
-
$gte:
|
|
59371
|
-
$lte:
|
|
59301
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("month").toDate(),
|
|
59302
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("month").toDate()
|
|
59372
59303
|
};
|
|
59373
59304
|
}
|
|
59374
59305
|
const upcomingEvents = await db.collection(events_namespace_collection).find({
|
|
@@ -60000,28 +59931,28 @@ function useNewDashboardRepo() {
|
|
|
60000
59931
|
let labels = [];
|
|
60001
59932
|
let getIntervalIndex;
|
|
60002
59933
|
if (period === "today" /* TODAY */) {
|
|
60003
|
-
rangeStart =
|
|
60004
|
-
rangeEnd =
|
|
59934
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
59935
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
60005
59936
|
labels = ["12 AM", "4 AM", "8 AM", "12 PM", "4 PM", "8 PM"];
|
|
60006
59937
|
getIntervalIndex = (date) => {
|
|
60007
|
-
const hour = (0,
|
|
59938
|
+
const hour = (0, import_moment.default)(date).tz("Asia/Singapore").hour();
|
|
60008
59939
|
return Math.floor(hour / 4);
|
|
60009
59940
|
};
|
|
60010
59941
|
} else if (period === "thisWeek" /* THIS_WEEK */) {
|
|
60011
|
-
rangeStart =
|
|
60012
|
-
rangeEnd =
|
|
59942
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate();
|
|
59943
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate();
|
|
60013
59944
|
labels = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
60014
59945
|
getIntervalIndex = (date) => {
|
|
60015
|
-
const day = (0,
|
|
59946
|
+
const day = (0, import_moment.default)(date).tz("Asia/Singapore").isoWeekday();
|
|
60016
59947
|
return day - 1;
|
|
60017
59948
|
};
|
|
60018
59949
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
60019
|
-
rangeStart =
|
|
60020
|
-
rangeEnd =
|
|
60021
|
-
const daysInMonth =
|
|
59950
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("month").toDate();
|
|
59951
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("month").toDate();
|
|
59952
|
+
const daysInMonth = import_moment.default.tz("Asia/Singapore").daysInMonth();
|
|
60022
59953
|
labels = Array.from({ length: daysInMonth }, (_, i) => String(i + 1));
|
|
60023
59954
|
getIntervalIndex = (date) => {
|
|
60024
|
-
return (0,
|
|
59955
|
+
return (0, import_moment.default)(date).tz("Asia/Singapore").date() - 1;
|
|
60025
59956
|
};
|
|
60026
59957
|
} else {
|
|
60027
59958
|
throw new import_node_server_utils201.BadRequestError("Invalid period.");
|
|
@@ -64143,7 +64074,6 @@ function sendEmailWithAttachmentsTo({
|
|
|
64143
64074
|
port: MAILER_TRANSPORT_PORT,
|
|
64144
64075
|
secure: MAILER_TRANSPORT_SECURE,
|
|
64145
64076
|
email: MAILER_EMAIL,
|
|
64146
|
-
from: MAILER_FROM_EMAIL,
|
|
64147
64077
|
password: MAILER_PASSWORD
|
|
64148
64078
|
};
|
|
64149
64079
|
const mailer = new import_node_server_utils221.useMailer(MailerConfig);
|
|
@@ -64897,7 +64827,6 @@ function useVerificationServiceV2() {
|
|
|
64897
64827
|
port: MAILER_TRANSPORT_PORT,
|
|
64898
64828
|
secure: MAILER_TRANSPORT_SECURE,
|
|
64899
64829
|
email: MAILER_EMAIL,
|
|
64900
|
-
from: MAILER_FROM_EMAIL,
|
|
64901
64830
|
password: MAILER_PASSWORD
|
|
64902
64831
|
};
|
|
64903
64832
|
const mailer = new import_node_server_utils227.useMailer(MailerConfig);
|