@7365admin1/core 2.38.0 → 2.39.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 +65 -32
- package/dist/index.js +335 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +334 -91
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ANPRMode: () => ANPRMode,
|
|
34
34
|
AccessTypeProps: () => AccessTypeProps,
|
|
35
|
+
AppServiceType: () => AppServiceType,
|
|
35
36
|
BuildingStatus: () => BuildingStatus,
|
|
36
37
|
BulletinRecipient: () => BulletinRecipient,
|
|
37
38
|
BulletinSort: () => BulletinSort,
|
|
@@ -442,6 +443,19 @@ __export(src_exports, {
|
|
|
442
443
|
});
|
|
443
444
|
module.exports = __toCommonJS(src_exports);
|
|
444
445
|
|
|
446
|
+
// src/models/base.model.ts
|
|
447
|
+
var AppServiceType = /* @__PURE__ */ ((AppServiceType2) => {
|
|
448
|
+
AppServiceType2["REAL_ESTATE_DEVELOPER"] = "real_estate_developer";
|
|
449
|
+
AppServiceType2["PROPERTY_MANAGEMENT_AGENCY"] = "property_management_agency";
|
|
450
|
+
AppServiceType2["SECURITY_AGENCY"] = "security_agency";
|
|
451
|
+
AppServiceType2["CLEANING_SERVICES"] = "cleaning_services";
|
|
452
|
+
AppServiceType2["MECHANICAL_ELECTRICAL_SERVICES"] = "mechanical_electrical_services";
|
|
453
|
+
AppServiceType2["LANDSCAPING_SERVICES"] = "landscaping_services";
|
|
454
|
+
AppServiceType2["PEST_CONTROL_SERVICES"] = "pest_control_services";
|
|
455
|
+
AppServiceType2["POOL_MAINTENANCE_SERVICES"] = "pool_maintenance_services";
|
|
456
|
+
return AppServiceType2;
|
|
457
|
+
})(AppServiceType || {});
|
|
458
|
+
|
|
445
459
|
// src/models/session.model.ts
|
|
446
460
|
var import_node_server_utils = require("@7365admin1/node-server-utils");
|
|
447
461
|
var import_joi = __toESM(require("joi"));
|
|
@@ -16741,13 +16755,53 @@ function useDahuaService() {
|
|
|
16741
16755
|
throw error2;
|
|
16742
16756
|
}
|
|
16743
16757
|
}
|
|
16758
|
+
async function bulkInsertPlateNumber(value) {
|
|
16759
|
+
const validation = import_joi39.default.object({
|
|
16760
|
+
host: import_joi39.default.string().required(),
|
|
16761
|
+
username: import_joi39.default.string().required(),
|
|
16762
|
+
password: import_joi39.default.string().required(),
|
|
16763
|
+
plateNumber: import_joi39.default.string().required(),
|
|
16764
|
+
mode: import_joi39.default.string().valid(...Object.values(ANPRMode)).required(),
|
|
16765
|
+
start: import_joi39.default.string().isoDate().optional().allow("", null),
|
|
16766
|
+
end: import_joi39.default.string().isoDate().optional().allow("", null),
|
|
16767
|
+
owner: import_joi39.default.string().optional().allow("", null),
|
|
16768
|
+
isOpenGate: import_joi39.default.boolean().optional().allow(null),
|
|
16769
|
+
vehicleType: import_joi39.default.string().optional().allow("", null),
|
|
16770
|
+
vehicleColor: import_joi39.default.string().optional().allow("", null)
|
|
16771
|
+
});
|
|
16772
|
+
const { error } = validation.validate(value);
|
|
16773
|
+
if (error) {
|
|
16774
|
+
throw new import_node_server_utils73.BadRequestError(`Validation error: ${error.message}`);
|
|
16775
|
+
}
|
|
16776
|
+
value.owner = String(value.owner ?? "").substring(0, 15) || "unknown";
|
|
16777
|
+
value.vehicleType = String(value.vehicleType ?? "").substring(0, 31) || "unknown";
|
|
16778
|
+
value.vehicleColor = String(value.vehicleColor ?? "").substring(0, 31) || "unknown";
|
|
16779
|
+
const _openGate = String(value.isOpenGate);
|
|
16780
|
+
const isOpenGateString = _openGate && _openGate !== "undefined" ? _openGate : "true";
|
|
16781
|
+
const endpoint = `/cgi-bin/recordUpdater.cgi?action=insert&name=${value.mode}&PlateNumber=${value.plateNumber}&VehicleType=${value.vehicleType}&VehicleColor=${value.vehicleColor}&BeginTime=${value.start}&CancelTime=${value.end}&+OpenGate=${isOpenGateString}&MasterOfCar=${value.owner}`;
|
|
16782
|
+
try {
|
|
16783
|
+
const response = await useDahuaDigest({
|
|
16784
|
+
host: value.host,
|
|
16785
|
+
username: value.username,
|
|
16786
|
+
password: value.password,
|
|
16787
|
+
endpoint
|
|
16788
|
+
});
|
|
16789
|
+
return response;
|
|
16790
|
+
} catch (error2) {
|
|
16791
|
+
import_node_server_utils73.logger.error(`[${value.host}] Error bulk add plate number:`, error2);
|
|
16792
|
+
throw new import_node_server_utils73.BadRequestError(
|
|
16793
|
+
`Failed bulk adding plate number: ${error2.message}`
|
|
16794
|
+
);
|
|
16795
|
+
}
|
|
16796
|
+
}
|
|
16744
16797
|
return {
|
|
16745
16798
|
getSnapshot,
|
|
16746
16799
|
getTrafficJunction,
|
|
16747
16800
|
addPlateNumber,
|
|
16748
16801
|
removePlateNumber,
|
|
16749
16802
|
updatePlateNumber,
|
|
16750
|
-
getPlateNumber
|
|
16803
|
+
getPlateNumber,
|
|
16804
|
+
bulkInsertPlateNumber
|
|
16751
16805
|
};
|
|
16752
16806
|
}
|
|
16753
16807
|
|
|
@@ -18986,6 +19040,21 @@ function useVehicleController() {
|
|
|
18986
19040
|
next(new import_node_server_utils86.BadRequestError("Only .xlsx files are allowed."));
|
|
18987
19041
|
return;
|
|
18988
19042
|
}
|
|
19043
|
+
const schema2 = import_joi46.default.object({
|
|
19044
|
+
fullName: import_joi46.default.string().trim().required(),
|
|
19045
|
+
userType: import_joi46.default.string().trim().required(),
|
|
19046
|
+
recordType: import_joi46.default.string().trim().required(),
|
|
19047
|
+
phoneNumber: import_joi46.default.string().trim().allow("", null).optional(),
|
|
19048
|
+
block: import_joi46.default.number().required(),
|
|
19049
|
+
level: import_joi46.default.number().integer().min(1).required(),
|
|
19050
|
+
unit: import_joi46.default.number().integer().min(1).required(),
|
|
19051
|
+
plateNumber: import_joi46.default.string().trim().uppercase().required(),
|
|
19052
|
+
vehicleModel: import_joi46.default.string().trim().allow("", null).optional(),
|
|
19053
|
+
vehicleColor: import_joi46.default.string().trim().allow("", null).optional(),
|
|
19054
|
+
subscriptionExpiry: import_joi46.default.string().trim().allow("", null).optional(),
|
|
19055
|
+
site: import_joi46.default.string().hex().length(24).required(),
|
|
19056
|
+
org: import_joi46.default.string().hex().length(24).required()
|
|
19057
|
+
});
|
|
18989
19058
|
const workbook = new import_exceljs.default.Workbook();
|
|
18990
19059
|
await workbook.xlsx.readFile(req.file.path);
|
|
18991
19060
|
const worksheet = workbook.worksheets[0];
|
|
@@ -19010,12 +19079,39 @@ function useVehicleController() {
|
|
|
19010
19079
|
rows.push(rowData);
|
|
19011
19080
|
}
|
|
19012
19081
|
});
|
|
19013
|
-
const
|
|
19014
|
-
const
|
|
19082
|
+
const validRows = [];
|
|
19083
|
+
const invalidRows = [];
|
|
19084
|
+
rows.forEach((row, index) => {
|
|
19085
|
+
const { error, value } = schema2.validate(row, {
|
|
19086
|
+
abortEarly: false,
|
|
19087
|
+
convert: true
|
|
19088
|
+
});
|
|
19089
|
+
if (error) {
|
|
19090
|
+
invalidRows.push({
|
|
19091
|
+
row: index + 2,
|
|
19092
|
+
data: row,
|
|
19093
|
+
errors: error.details.map((d) => d.message)
|
|
19094
|
+
});
|
|
19095
|
+
return;
|
|
19096
|
+
}
|
|
19097
|
+
validRows.push(value);
|
|
19098
|
+
});
|
|
19099
|
+
const vehicles = validRows.map(mapRowToVehicle);
|
|
19100
|
+
let data = {
|
|
19101
|
+
matchedCount: 0,
|
|
19102
|
+
modifiedCount: 0,
|
|
19103
|
+
upsertedCount: 0
|
|
19104
|
+
};
|
|
19105
|
+
if (vehicles.length > 0) {
|
|
19106
|
+
data = await _bulkUpsertVehicles(vehicles);
|
|
19107
|
+
}
|
|
19015
19108
|
res.status(200).json({
|
|
19016
19109
|
message: "Excel import completed.",
|
|
19017
19110
|
sheetName: worksheet.name,
|
|
19018
|
-
|
|
19111
|
+
totalRows: rows.length,
|
|
19112
|
+
validRows: validRows.length,
|
|
19113
|
+
invalidRows: invalidRows.length,
|
|
19114
|
+
validationErrors: invalidRows,
|
|
19019
19115
|
data
|
|
19020
19116
|
});
|
|
19021
19117
|
import_fs2.default.unlink(req.file.path, () => {
|
|
@@ -19349,69 +19445,6 @@ function useVehicleController() {
|
|
|
19349
19445
|
return;
|
|
19350
19446
|
}
|
|
19351
19447
|
}
|
|
19352
|
-
async function bulkUpsertVehicles(req, res, next) {
|
|
19353
|
-
const items = Array.isArray(req.body) ? req.body : req.body?.items;
|
|
19354
|
-
if (!Array.isArray(items) || items.length === 0) {
|
|
19355
|
-
next(new import_node_server_utils86.BadRequestError("A non-empty array of vehicles is required."));
|
|
19356
|
-
return;
|
|
19357
|
-
}
|
|
19358
|
-
const success = [];
|
|
19359
|
-
const failed = [];
|
|
19360
|
-
try {
|
|
19361
|
-
for (let index = 0; index < items.length; index++) {
|
|
19362
|
-
const item = items[index];
|
|
19363
|
-
const schema2 = import_joi46.default.object({
|
|
19364
|
-
fullName: import_joi46.default.string().trim().required(),
|
|
19365
|
-
category: import_joi46.default.string().trim().lowercase().valid(...Object.values(PersonTypes)).required(),
|
|
19366
|
-
type: import_joi46.default.string().trim().lowercase().valid(...Object.values(VehicleType)),
|
|
19367
|
-
phoneNumber: import_joi46.default.string().trim().allow(null, "").optional(),
|
|
19368
|
-
block: import_joi46.default.number().integer().min(1).required(),
|
|
19369
|
-
level: import_joi46.default.string().trim().required(),
|
|
19370
|
-
unit: import_joi46.default.string().trim().required(),
|
|
19371
|
-
plateNumber: import_joi46.default.string().trim().uppercase().required(),
|
|
19372
|
-
vehicleModel: import_joi46.default.string().trim().required(),
|
|
19373
|
-
vehicleColor: import_joi46.default.string().trim().required(),
|
|
19374
|
-
subscriptionExpiry: import_joi46.default.string().trim().allow(null, "").optional()
|
|
19375
|
-
});
|
|
19376
|
-
const { error, value } = schema2.validate(item, {
|
|
19377
|
-
abortEarly: false
|
|
19378
|
-
});
|
|
19379
|
-
if (error) {
|
|
19380
|
-
const message = error.details.map((d) => d.message).join(", ");
|
|
19381
|
-
failed.push({
|
|
19382
|
-
index,
|
|
19383
|
-
item,
|
|
19384
|
-
message
|
|
19385
|
-
});
|
|
19386
|
-
continue;
|
|
19387
|
-
}
|
|
19388
|
-
try {
|
|
19389
|
-
const data = await _bulkUpsertVehicles(value);
|
|
19390
|
-
success.push({
|
|
19391
|
-
index,
|
|
19392
|
-
data
|
|
19393
|
-
});
|
|
19394
|
-
} catch (error2) {
|
|
19395
|
-
failed.push({
|
|
19396
|
-
index,
|
|
19397
|
-
item,
|
|
19398
|
-
message: error2.message
|
|
19399
|
-
});
|
|
19400
|
-
}
|
|
19401
|
-
}
|
|
19402
|
-
res.status(201).json({
|
|
19403
|
-
message: "Bulk vehicle import completed.",
|
|
19404
|
-
successCount: success.length,
|
|
19405
|
-
failedCount: failed.length,
|
|
19406
|
-
success,
|
|
19407
|
-
failed
|
|
19408
|
-
});
|
|
19409
|
-
} catch (error) {
|
|
19410
|
-
import_node_server_utils86.logger.log({ level: "error", message: error.message });
|
|
19411
|
-
next(error);
|
|
19412
|
-
return;
|
|
19413
|
-
}
|
|
19414
|
-
}
|
|
19415
19448
|
return {
|
|
19416
19449
|
add,
|
|
19417
19450
|
getVehicles,
|
|
@@ -19423,7 +19456,6 @@ function useVehicleController() {
|
|
|
19423
19456
|
getVehiclesByNRIC,
|
|
19424
19457
|
reactivateVehicleById,
|
|
19425
19458
|
getAllVehiclesByUnitId,
|
|
19426
|
-
bulkUpsertVehicles,
|
|
19427
19459
|
uploadCsvVehicles,
|
|
19428
19460
|
uploadExcelVehicles
|
|
19429
19461
|
};
|
|
@@ -20183,21 +20215,6 @@ function useCustomerSiteController() {
|
|
|
20183
20215
|
var import_node_server_utils92 = require("@7365admin1/node-server-utils");
|
|
20184
20216
|
var import_joi51 = __toESM(require("joi"));
|
|
20185
20217
|
var import_mongodb51 = require("mongodb");
|
|
20186
|
-
|
|
20187
|
-
// src/models/base.model.ts
|
|
20188
|
-
var AppServiceType = /* @__PURE__ */ ((AppServiceType2) => {
|
|
20189
|
-
AppServiceType2["REAL_ESTATE_DEVELOPER"] = "real_estate_developer";
|
|
20190
|
-
AppServiceType2["PROPERTY_MANAGEMENT_AGENCY"] = "property_management_agency";
|
|
20191
|
-
AppServiceType2["SECURITY_AGENCY"] = "security_agency";
|
|
20192
|
-
AppServiceType2["CLEANING_SERVICES"] = "cleaning_services";
|
|
20193
|
-
AppServiceType2["MECHANICAL_ELECTRICAL_SERVICES"] = "mechanical_electrical_services";
|
|
20194
|
-
AppServiceType2["LANDSCAPING_SERVICES"] = "landscaping_services";
|
|
20195
|
-
AppServiceType2["PEST_CONTROL_SERVICES"] = "pest_control_services";
|
|
20196
|
-
AppServiceType2["POOL_MAINTENANCE_SERVICES"] = "pool_maintenance_services";
|
|
20197
|
-
return AppServiceType2;
|
|
20198
|
-
})(AppServiceType || {});
|
|
20199
|
-
|
|
20200
|
-
// src/models/attendance-settings.model.ts
|
|
20201
20218
|
var attendanceSettingsSchema = import_joi51.default.object({
|
|
20202
20219
|
site: import_joi51.default.string().hex().required(),
|
|
20203
20220
|
serviceType: import_joi51.default.string().valid(...Object.values(AppServiceType)).required(),
|
|
@@ -31656,6 +31673,95 @@ function useSiteUnitBillingRepo() {
|
|
|
31656
31673
|
throw error;
|
|
31657
31674
|
}
|
|
31658
31675
|
}
|
|
31676
|
+
async function getResidentUserUnsettledBilling({
|
|
31677
|
+
search = "",
|
|
31678
|
+
page = 1,
|
|
31679
|
+
limit = 10,
|
|
31680
|
+
sort = {},
|
|
31681
|
+
status = "active",
|
|
31682
|
+
site = "",
|
|
31683
|
+
paymentStatus = "all",
|
|
31684
|
+
month,
|
|
31685
|
+
year,
|
|
31686
|
+
unitId
|
|
31687
|
+
}, session) {
|
|
31688
|
+
page = page > 0 ? page - 1 : 0;
|
|
31689
|
+
let dateExpr = {};
|
|
31690
|
+
if (month && year) {
|
|
31691
|
+
const monthNum = parseInt(month, 10);
|
|
31692
|
+
const yearNum = parseInt(year, 10);
|
|
31693
|
+
const startDate = new Date(yearNum, monthNum - 1, 1);
|
|
31694
|
+
const endDate = new Date(yearNum, monthNum, 1);
|
|
31695
|
+
dateExpr.createdAt = {
|
|
31696
|
+
$gte: startDate,
|
|
31697
|
+
$lt: endDate
|
|
31698
|
+
};
|
|
31699
|
+
}
|
|
31700
|
+
const unitSearchRegex = search ? search.trim().replace(/\s+/g, "").replace(/\//g, "\\s*/\\s*") : null;
|
|
31701
|
+
const query = {
|
|
31702
|
+
...paymentStatus === "all" ? { paymentStatus: { $in: ["failed", "overdue"] } } : { paymentStatus },
|
|
31703
|
+
status,
|
|
31704
|
+
...search && {
|
|
31705
|
+
$or: [
|
|
31706
|
+
{ unitOwner: { $regex: search, $options: "i" } },
|
|
31707
|
+
{ billName: { $regex: search, $options: "i" } },
|
|
31708
|
+
{ unit: { $regex: unitSearchRegex, $options: "i" } },
|
|
31709
|
+
{
|
|
31710
|
+
$expr: {
|
|
31711
|
+
$regexMatch: {
|
|
31712
|
+
input: { $toString: "$amountPaid" },
|
|
31713
|
+
regex: search,
|
|
31714
|
+
options: "i"
|
|
31715
|
+
}
|
|
31716
|
+
}
|
|
31717
|
+
}
|
|
31718
|
+
]
|
|
31719
|
+
},
|
|
31720
|
+
...import_mongodb86.ObjectId.isValid(site) && { site: new import_mongodb86.ObjectId(site) },
|
|
31721
|
+
...dateExpr,
|
|
31722
|
+
...import_mongodb86.ObjectId.isValid(unitId) && { unitId: new import_mongodb86.ObjectId(unitId) }
|
|
31723
|
+
};
|
|
31724
|
+
sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
|
|
31725
|
+
try {
|
|
31726
|
+
const basePipeline = [
|
|
31727
|
+
{ $match: query },
|
|
31728
|
+
{ $sort: sort },
|
|
31729
|
+
{ $skip: page * limit },
|
|
31730
|
+
{ $limit: limit },
|
|
31731
|
+
{
|
|
31732
|
+
$lookup: {
|
|
31733
|
+
from: "site.billing.items",
|
|
31734
|
+
localField: "billItem",
|
|
31735
|
+
foreignField: "_id",
|
|
31736
|
+
pipeline: [
|
|
31737
|
+
{
|
|
31738
|
+
$project: {
|
|
31739
|
+
_id: 1,
|
|
31740
|
+
totalAmount: 1
|
|
31741
|
+
}
|
|
31742
|
+
}
|
|
31743
|
+
],
|
|
31744
|
+
as: "billDetails"
|
|
31745
|
+
}
|
|
31746
|
+
},
|
|
31747
|
+
{
|
|
31748
|
+
$unwind: {
|
|
31749
|
+
path: "$billDetails",
|
|
31750
|
+
preserveNullAndEmptyArrays: true
|
|
31751
|
+
}
|
|
31752
|
+
}
|
|
31753
|
+
];
|
|
31754
|
+
const [items, countResult] = await Promise.all([
|
|
31755
|
+
collection.aggregate(basePipeline, { session }).toArray(),
|
|
31756
|
+
collection.aggregate([{ $match: query }, { $count: "total" }], { session }).toArray()
|
|
31757
|
+
]);
|
|
31758
|
+
const totalCount = countResult[0]?.total || 0;
|
|
31759
|
+
const data = (0, import_node_server_utils149.paginate)(items, page, limit, totalCount);
|
|
31760
|
+
return data;
|
|
31761
|
+
} catch (error) {
|
|
31762
|
+
throw error;
|
|
31763
|
+
}
|
|
31764
|
+
}
|
|
31659
31765
|
function delCachedData() {
|
|
31660
31766
|
delNamespace().then(() => {
|
|
31661
31767
|
import_node_server_utils149.logger.log({
|
|
@@ -31688,7 +31794,8 @@ function useSiteUnitBillingRepo() {
|
|
|
31688
31794
|
updateById,
|
|
31689
31795
|
deleteById,
|
|
31690
31796
|
getUnitBillingBySite,
|
|
31691
|
-
getResidentUserBilling
|
|
31797
|
+
getResidentUserBilling,
|
|
31798
|
+
getResidentUserUnsettledBilling
|
|
31692
31799
|
};
|
|
31693
31800
|
}
|
|
31694
31801
|
|
|
@@ -31876,7 +31983,8 @@ function useSiteUnitBillingController() {
|
|
|
31876
31983
|
updateById: _updateById,
|
|
31877
31984
|
deleteById: _deleteById,
|
|
31878
31985
|
getById: _getById,
|
|
31879
|
-
getResidentUserBilling: _getResidentUserBilling
|
|
31986
|
+
getResidentUserBilling: _getResidentUserBilling,
|
|
31987
|
+
getResidentUserUnsettledBilling: _getResidentUserUnsettledBilling
|
|
31880
31988
|
} = useSiteUnitBillingRepo();
|
|
31881
31989
|
async function add(req, res, next) {
|
|
31882
31990
|
const data = { ...req.body };
|
|
@@ -32068,13 +32176,65 @@ function useSiteUnitBillingController() {
|
|
|
32068
32176
|
return;
|
|
32069
32177
|
}
|
|
32070
32178
|
}
|
|
32179
|
+
async function getResidentUserUnsettledBilling(req, res, next) {
|
|
32180
|
+
const validation = import_joi84.default.object({
|
|
32181
|
+
page: import_joi84.default.number().integer().min(1).allow("", null).default(1),
|
|
32182
|
+
limit: import_joi84.default.number().integer().min(1).max(100).allow("", null).default(10),
|
|
32183
|
+
status: import_joi84.default.string().optional().allow(null, ""),
|
|
32184
|
+
search: import_joi84.default.string().optional().allow(null, ""),
|
|
32185
|
+
site: import_joi84.default.string().required(),
|
|
32186
|
+
paymentStatus: import_joi84.default.string().optional().allow(null, ""),
|
|
32187
|
+
month: import_joi84.default.string().optional().allow(null, ""),
|
|
32188
|
+
year: import_joi84.default.string().optional().allow(null, ""),
|
|
32189
|
+
unitId: import_joi84.default.string().optional().allow(null, "")
|
|
32190
|
+
});
|
|
32191
|
+
const query = { ...req.query };
|
|
32192
|
+
const { error } = validation.validate(query, {
|
|
32193
|
+
abortEarly: false
|
|
32194
|
+
});
|
|
32195
|
+
if (error) {
|
|
32196
|
+
const messages = error.details.map((d) => d.message).join(", ");
|
|
32197
|
+
import_node_server_utils151.logger.log({ level: "error", message: messages });
|
|
32198
|
+
next(new import_node_server_utils151.BadRequestError(messages));
|
|
32199
|
+
return;
|
|
32200
|
+
}
|
|
32201
|
+
const search = req.query.search ?? "";
|
|
32202
|
+
const page = parseInt(req.query.page ?? "1");
|
|
32203
|
+
const limit = parseInt(req.query.limit ?? "10");
|
|
32204
|
+
const status = req.query.status ?? "active";
|
|
32205
|
+
const site = req.query.site;
|
|
32206
|
+
const paymentStatus = req.query.paymentStatus ?? "awaiting_payment";
|
|
32207
|
+
const month = req.query.month ?? "";
|
|
32208
|
+
const year = req.query.year ?? "";
|
|
32209
|
+
const unitId = req.query.unitId ?? "";
|
|
32210
|
+
try {
|
|
32211
|
+
const data = await _getResidentUserUnsettledBilling({
|
|
32212
|
+
search,
|
|
32213
|
+
page,
|
|
32214
|
+
limit,
|
|
32215
|
+
status,
|
|
32216
|
+
site,
|
|
32217
|
+
paymentStatus,
|
|
32218
|
+
month,
|
|
32219
|
+
year,
|
|
32220
|
+
unitId
|
|
32221
|
+
});
|
|
32222
|
+
res.status(200).json(data);
|
|
32223
|
+
return;
|
|
32224
|
+
} catch (error2) {
|
|
32225
|
+
import_node_server_utils151.logger.log({ level: "error", message: error2.message });
|
|
32226
|
+
next(error2);
|
|
32227
|
+
return;
|
|
32228
|
+
}
|
|
32229
|
+
}
|
|
32071
32230
|
return {
|
|
32072
32231
|
add,
|
|
32073
32232
|
getAll,
|
|
32074
32233
|
getById,
|
|
32075
32234
|
updateById,
|
|
32076
32235
|
deleteById,
|
|
32077
|
-
getResidentUserBilling
|
|
32236
|
+
getResidentUserBilling,
|
|
32237
|
+
getResidentUserUnsettledBilling
|
|
32078
32238
|
};
|
|
32079
32239
|
}
|
|
32080
32240
|
|
|
@@ -34254,6 +34414,61 @@ function UseAccessManagementRepo() {
|
|
|
34254
34414
|
await session?.endSession();
|
|
34255
34415
|
}
|
|
34256
34416
|
}
|
|
34417
|
+
async function getBlockLevelAndUnitListRepo(params) {
|
|
34418
|
+
const site = new import_mongodb89.ObjectId(params.site);
|
|
34419
|
+
try {
|
|
34420
|
+
const blocks = await collectionName("buildings").aggregate([
|
|
34421
|
+
{
|
|
34422
|
+
$match: {
|
|
34423
|
+
site,
|
|
34424
|
+
status: { $eq: "active" }
|
|
34425
|
+
}
|
|
34426
|
+
},
|
|
34427
|
+
{
|
|
34428
|
+
$project: {
|
|
34429
|
+
_id: 1,
|
|
34430
|
+
name: 1,
|
|
34431
|
+
block: 1
|
|
34432
|
+
}
|
|
34433
|
+
},
|
|
34434
|
+
{
|
|
34435
|
+
$lookup: {
|
|
34436
|
+
from: "building-levels",
|
|
34437
|
+
localField: "_id",
|
|
34438
|
+
foreignField: "block",
|
|
34439
|
+
as: "levels",
|
|
34440
|
+
pipeline: [
|
|
34441
|
+
{
|
|
34442
|
+
$match: { status: { $ne: "deleted" } }
|
|
34443
|
+
},
|
|
34444
|
+
{
|
|
34445
|
+
$lookup: {
|
|
34446
|
+
from: "building-units",
|
|
34447
|
+
localField: "_id",
|
|
34448
|
+
foreignField: "level",
|
|
34449
|
+
pipeline: [
|
|
34450
|
+
{ $match: { status: { $ne: "deleted" } } },
|
|
34451
|
+
{ $project: { _id: 1, name: 1, buildingName: 1, level: 1, block: 1 } }
|
|
34452
|
+
],
|
|
34453
|
+
as: "units"
|
|
34454
|
+
}
|
|
34455
|
+
},
|
|
34456
|
+
{
|
|
34457
|
+
$match: { "units.0": { $exists: true } }
|
|
34458
|
+
}
|
|
34459
|
+
]
|
|
34460
|
+
}
|
|
34461
|
+
},
|
|
34462
|
+
// ✅ Filter out buildings with no levels early
|
|
34463
|
+
{
|
|
34464
|
+
$match: { "levels.0": { $exists: true } }
|
|
34465
|
+
}
|
|
34466
|
+
]).toArray();
|
|
34467
|
+
return blocks;
|
|
34468
|
+
} catch (error) {
|
|
34469
|
+
throw new Error(error.message);
|
|
34470
|
+
}
|
|
34471
|
+
}
|
|
34257
34472
|
return {
|
|
34258
34473
|
createIndexes,
|
|
34259
34474
|
createIndexForEntrypass,
|
|
@@ -34283,7 +34498,8 @@ function UseAccessManagementRepo() {
|
|
|
34283
34498
|
vmsgenerateQrCodesRepo,
|
|
34284
34499
|
addVisitorAccessCardRepo,
|
|
34285
34500
|
signQrCodeRepo,
|
|
34286
|
-
checkoutVisitorRepo
|
|
34501
|
+
checkoutVisitorRepo,
|
|
34502
|
+
getBlockLevelAndUnitListRepo
|
|
34287
34503
|
};
|
|
34288
34504
|
}
|
|
34289
34505
|
|
|
@@ -34322,7 +34538,8 @@ function useAccessManagementSvc() {
|
|
|
34322
34538
|
vmsgenerateQrCodesRepo,
|
|
34323
34539
|
addVisitorAccessCardRepo,
|
|
34324
34540
|
signQrCodeRepo,
|
|
34325
|
-
checkoutVisitorRepo
|
|
34541
|
+
checkoutVisitorRepo,
|
|
34542
|
+
getBlockLevelAndUnitListRepo
|
|
34326
34543
|
} = UseAccessManagementRepo();
|
|
34327
34544
|
const addPhysicalCardSvc = async (payload) => {
|
|
34328
34545
|
try {
|
|
@@ -34606,6 +34823,14 @@ function useAccessManagementSvc() {
|
|
|
34606
34823
|
throw new Error(err.message);
|
|
34607
34824
|
}
|
|
34608
34825
|
};
|
|
34826
|
+
const getBlockLevelAndUnitListSvc = async (params) => {
|
|
34827
|
+
try {
|
|
34828
|
+
const response = await getBlockLevelAndUnitListRepo({ ...params });
|
|
34829
|
+
return response;
|
|
34830
|
+
} catch (err) {
|
|
34831
|
+
throw new Error(err.message);
|
|
34832
|
+
}
|
|
34833
|
+
};
|
|
34609
34834
|
return {
|
|
34610
34835
|
addPhysicalCardSvc,
|
|
34611
34836
|
addNonPhysicalCardSvc,
|
|
@@ -34639,7 +34864,8 @@ function useAccessManagementSvc() {
|
|
|
34639
34864
|
vmsgenerateQrCodesSvc,
|
|
34640
34865
|
addVisitorAccessCardSvc,
|
|
34641
34866
|
signQrCodeSvc,
|
|
34642
|
-
checkoutVisitorSvc
|
|
34867
|
+
checkoutVisitorSvc,
|
|
34868
|
+
getBlockLevelAndUnitListSvc
|
|
34643
34869
|
};
|
|
34644
34870
|
}
|
|
34645
34871
|
|
|
@@ -34678,7 +34904,8 @@ function useAccessManagementController() {
|
|
|
34678
34904
|
vmsgenerateQrCodesSvc,
|
|
34679
34905
|
addVisitorAccessCardSvc,
|
|
34680
34906
|
signQrCodeSvc,
|
|
34681
|
-
checkoutVisitorSvc
|
|
34907
|
+
checkoutVisitorSvc,
|
|
34908
|
+
getBlockLevelAndUnitListSvc
|
|
34682
34909
|
} = useAccessManagementSvc();
|
|
34683
34910
|
const addPhysicalCard = async (req, res) => {
|
|
34684
34911
|
try {
|
|
@@ -35425,6 +35652,21 @@ function useAccessManagementController() {
|
|
|
35425
35652
|
const removeAccessCard = async ({ cardNo, staffNo, url }) => {
|
|
35426
35653
|
return removeAccessGroup({ cardNo, staffNo, url });
|
|
35427
35654
|
};
|
|
35655
|
+
const getBlockLevelAndUnitList = async (req, res) => {
|
|
35656
|
+
try {
|
|
35657
|
+
const { site } = req.query;
|
|
35658
|
+
if (!site || typeof site !== "string") {
|
|
35659
|
+
throw new Error("Site is required");
|
|
35660
|
+
}
|
|
35661
|
+
const result = await getBlockLevelAndUnitListSvc({ site });
|
|
35662
|
+
return res.status(200).json({ message: "Success", data: result });
|
|
35663
|
+
} catch (error) {
|
|
35664
|
+
return res.status(400).json({
|
|
35665
|
+
data: null,
|
|
35666
|
+
message: error.message
|
|
35667
|
+
});
|
|
35668
|
+
}
|
|
35669
|
+
};
|
|
35428
35670
|
return {
|
|
35429
35671
|
addPhysicalCard,
|
|
35430
35672
|
addNonPhysicalCard,
|
|
@@ -35456,7 +35698,8 @@ function useAccessManagementController() {
|
|
|
35456
35698
|
addVisitorAccessCard,
|
|
35457
35699
|
signQrCode,
|
|
35458
35700
|
checkoutVisitor,
|
|
35459
|
-
removeAccessCard
|
|
35701
|
+
removeAccessCard,
|
|
35702
|
+
getBlockLevelAndUnitList
|
|
35460
35703
|
};
|
|
35461
35704
|
}
|
|
35462
35705
|
|
|
@@ -49115,6 +49358,7 @@ function useRoleControllerV2() {
|
|
|
49115
49358
|
0 && (module.exports = {
|
|
49116
49359
|
ANPRMode,
|
|
49117
49360
|
AccessTypeProps,
|
|
49361
|
+
AppServiceType,
|
|
49118
49362
|
BuildingStatus,
|
|
49119
49363
|
BulletinRecipient,
|
|
49120
49364
|
BulletinSort,
|