@7365admin1/core 3.32.2-staging.2 → 3.32.2-staging.4
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/dist/index.d.ts +1 -1
- package/dist/index.js +63 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2965,7 +2965,7 @@ declare function useVisitorTransactionRepo(): {
|
|
|
2965
2965
|
pageRange: string;
|
|
2966
2966
|
}>;
|
|
2967
2967
|
getOpenByPlateNumber: (plateNumber: string, site: string | ObjectId) => Promise<TVisitorTransaction | null | undefined>;
|
|
2968
|
-
updateById: (_id: string | ObjectId, value: Partial<TVisitorTransaction>, session?: ClientSession, isManualCheckOut?: boolean) => Promise<mongodb.UpdateResult<bson.Document
|
|
2968
|
+
updateById: (_id: string | ObjectId, value: Partial<TVisitorTransaction>, session?: ClientSession, isManualCheckOut?: boolean) => Promise<mongodb.UpdateResult<bson.Document> | undefined>;
|
|
2969
2969
|
deleteVisitorTransaction: (_id: string | ObjectId) => Promise<number>;
|
|
2970
2970
|
createTextIndex: () => Promise<void>;
|
|
2971
2971
|
getDeliveryPickupTransactions: () => Promise<mongodb.WithId<bson.Document>[]>;
|
package/dist/index.js
CHANGED
|
@@ -22137,7 +22137,14 @@ function useVisitorTransactionRepo() {
|
|
|
22137
22137
|
}
|
|
22138
22138
|
});
|
|
22139
22139
|
if (Array.isArray(value.visitorPass)) {
|
|
22140
|
-
|
|
22140
|
+
const visitorPassMap = /* @__PURE__ */ new Map();
|
|
22141
|
+
value.visitorPass.forEach((item) => {
|
|
22142
|
+
if (item.keyId) {
|
|
22143
|
+
visitorPassMap.set(item.keyId.toString(), item);
|
|
22144
|
+
}
|
|
22145
|
+
});
|
|
22146
|
+
const uniqueVisitorPass = Array.from(visitorPassMap.values());
|
|
22147
|
+
uniqueVisitorPass.forEach((item, index) => {
|
|
22141
22148
|
if (item.add === true) {
|
|
22142
22149
|
const { add: add2, ...cleanItem } = item;
|
|
22143
22150
|
cleanItem.keyId = convertObjectIdUtilNonAsync(cleanItem.keyId, "Pass Id");
|
|
@@ -22150,8 +22157,7 @@ function useVisitorTransactionRepo() {
|
|
|
22150
22157
|
Object.keys(item).forEach((itemKey) => {
|
|
22151
22158
|
if (itemKey !== "keyId") {
|
|
22152
22159
|
const typedItemKey = itemKey;
|
|
22153
|
-
|
|
22154
|
-
updateFields[`visitorPass.$[${elementKey}].${itemKey}`] = itemValue;
|
|
22160
|
+
updateFields[`visitorPass.$[${elementKey}].${itemKey}`] = item[typedItemKey];
|
|
22155
22161
|
}
|
|
22156
22162
|
});
|
|
22157
22163
|
arrayFilters.push({ [`${elementKey}.keyId`]: new import_mongodb41.ObjectId(item.keyId) });
|
|
@@ -22159,7 +22165,14 @@ function useVisitorTransactionRepo() {
|
|
|
22159
22165
|
});
|
|
22160
22166
|
}
|
|
22161
22167
|
if (Array.isArray(value.passKeys)) {
|
|
22162
|
-
|
|
22168
|
+
const passKeysMap = /* @__PURE__ */ new Map();
|
|
22169
|
+
value.passKeys.forEach((item) => {
|
|
22170
|
+
if (item.keyId) {
|
|
22171
|
+
passKeysMap.set(item.keyId.toString(), item);
|
|
22172
|
+
}
|
|
22173
|
+
});
|
|
22174
|
+
const uniquePassKeys = Array.from(passKeysMap.values());
|
|
22175
|
+
uniquePassKeys.forEach((item, index) => {
|
|
22163
22176
|
if (item.add === true) {
|
|
22164
22177
|
const { add: add2, ...cleanItem } = item;
|
|
22165
22178
|
cleanItem.keyId = convertObjectIdUtilNonAsync(cleanItem.keyId, "Key Id");
|
|
@@ -22172,32 +22185,34 @@ function useVisitorTransactionRepo() {
|
|
|
22172
22185
|
Object.keys(item).forEach((itemKey) => {
|
|
22173
22186
|
if (itemKey !== "keyId") {
|
|
22174
22187
|
const typedItemKey = itemKey;
|
|
22175
|
-
|
|
22176
|
-
updateFields[`passKeys.$[${elementKey}].${itemKey}`] = itemValue;
|
|
22188
|
+
updateFields[`passKeys.$[${elementKey}].${itemKey}`] = item[typedItemKey];
|
|
22177
22189
|
}
|
|
22178
22190
|
});
|
|
22179
22191
|
arrayFilters.push({ [`${elementKey}.keyId`]: new import_mongodb41.ObjectId(item.keyId) });
|
|
22180
22192
|
}
|
|
22181
22193
|
});
|
|
22182
22194
|
}
|
|
22183
|
-
|
|
22195
|
+
let result;
|
|
22184
22196
|
if (Object.keys(updateFields).length > 0) {
|
|
22185
|
-
|
|
22197
|
+
result = await collection.updateOne(
|
|
22198
|
+
{ _id: new import_mongodb41.ObjectId(_id) },
|
|
22199
|
+
{ $set: updateFields },
|
|
22200
|
+
{
|
|
22201
|
+
...arrayFilters.length > 0 && { arrayFilters },
|
|
22202
|
+
session
|
|
22203
|
+
}
|
|
22204
|
+
);
|
|
22186
22205
|
}
|
|
22187
22206
|
if (Object.keys(pushFields).length > 0) {
|
|
22188
|
-
|
|
22207
|
+
result = await collection.updateOne(
|
|
22208
|
+
{ _id: new import_mongodb41.ObjectId(_id) },
|
|
22209
|
+
{ $push: pushFields },
|
|
22210
|
+
{ session }
|
|
22211
|
+
);
|
|
22189
22212
|
}
|
|
22190
|
-
const result = await collection.updateOne(
|
|
22191
|
-
{ _id: new import_mongodb41.ObjectId(_id) },
|
|
22192
|
-
updatePayload,
|
|
22193
|
-
{
|
|
22194
|
-
...arrayFilters.length > 0 && { arrayFilters },
|
|
22195
|
-
// Only pass if not empty
|
|
22196
|
-
session
|
|
22197
|
-
}
|
|
22198
|
-
);
|
|
22199
22213
|
return result;
|
|
22200
22214
|
} catch (error) {
|
|
22215
|
+
console.log("Error in updateById visitor transaction repo", error);
|
|
22201
22216
|
throw error;
|
|
22202
22217
|
}
|
|
22203
22218
|
}
|
|
@@ -26986,7 +27001,8 @@ function useVehicleService() {
|
|
|
26986
27001
|
throw new Error("Unable to start session for vehicle service.");
|
|
26987
27002
|
}
|
|
26988
27003
|
}
|
|
26989
|
-
const
|
|
27004
|
+
const plateNumbers = Array.isArray(value.plateNumber) ? value.plateNumber : value.plateNumber ? [value.plateNumber] : [];
|
|
27005
|
+
const [_vehiclePlateNumber] = plateNumbers;
|
|
26990
27006
|
const [existingPlateNumber, org] = await Promise.all([
|
|
26991
27007
|
_getVehicleByPlateNumber(_vehiclePlateNumber),
|
|
26992
27008
|
_getById(value.org)
|
|
@@ -27051,7 +27067,6 @@ function useVehicleService() {
|
|
|
27051
27067
|
}
|
|
27052
27068
|
}
|
|
27053
27069
|
const owner = value.name;
|
|
27054
|
-
const plateNumbers = value.plateNumber;
|
|
27055
27070
|
try {
|
|
27056
27071
|
if (!isExternalSession) {
|
|
27057
27072
|
session.startTransaction();
|
|
@@ -27268,7 +27283,10 @@ function useVehicleService() {
|
|
|
27268
27283
|
const dahuaResponse = await _addPlateNumber(dahuaPayload);
|
|
27269
27284
|
if (dahuaResponse?.statusCode != 200) {
|
|
27270
27285
|
console.log("dahuaResponse", dahuaResponse);
|
|
27271
|
-
console.log(
|
|
27286
|
+
console.log(
|
|
27287
|
+
"approveVehicleById dahuaResponse dahuaResponse?.statusCode != 200",
|
|
27288
|
+
dahuaResponse?.statusCode
|
|
27289
|
+
);
|
|
27272
27290
|
throw new import_node_server_utils78.BadRequestError("Failed to add plate number to ANPR");
|
|
27273
27291
|
}
|
|
27274
27292
|
const responseData = dahuaResponse?.data.toString("utf-8");
|
|
@@ -27475,7 +27493,19 @@ function useVehicleService() {
|
|
|
27475
27493
|
if (value.peopleId) {
|
|
27476
27494
|
value.peopleId = new import_mongodb49.ObjectId(value.peopleId);
|
|
27477
27495
|
}
|
|
27478
|
-
const {
|
|
27496
|
+
const {
|
|
27497
|
+
name,
|
|
27498
|
+
plateNumber,
|
|
27499
|
+
start,
|
|
27500
|
+
end,
|
|
27501
|
+
recNo,
|
|
27502
|
+
type,
|
|
27503
|
+
unit,
|
|
27504
|
+
site,
|
|
27505
|
+
block,
|
|
27506
|
+
level,
|
|
27507
|
+
...rest
|
|
27508
|
+
} = value;
|
|
27479
27509
|
if (_name != name || _plateNumber != plateNumber) {
|
|
27480
27510
|
const startDahua = value.start ? formatDahuaDate(new Date(value.start)) : formatDahuaDate(new Date(_start));
|
|
27481
27511
|
const endDahua = value.end ? formatDahuaDate(new Date(value.end)) : formatDahuaDate(new Date(_end));
|
|
@@ -27502,7 +27532,11 @@ function useVehicleService() {
|
|
|
27502
27532
|
for (const camera of siteCameras) {
|
|
27503
27533
|
const { host, username, password } = camera;
|
|
27504
27534
|
if (_plateNumber != plateNumber) {
|
|
27505
|
-
console.log(
|
|
27535
|
+
console.log(
|
|
27536
|
+
"updateVehicleById _plateNumber != plateNumber",
|
|
27537
|
+
_plateNumber,
|
|
27538
|
+
plateNumber
|
|
27539
|
+
);
|
|
27506
27540
|
const removePlateNumber = {
|
|
27507
27541
|
host,
|
|
27508
27542
|
username,
|
|
@@ -27549,7 +27583,11 @@ function useVehicleService() {
|
|
|
27549
27583
|
);
|
|
27550
27584
|
}
|
|
27551
27585
|
} else {
|
|
27552
|
-
console.log(
|
|
27586
|
+
console.log(
|
|
27587
|
+
"updateVehicleById _plateNumber == plateNumber",
|
|
27588
|
+
_plateNumber,
|
|
27589
|
+
plateNumber
|
|
27590
|
+
);
|
|
27553
27591
|
const dahuaPayload = {
|
|
27554
27592
|
host,
|
|
27555
27593
|
username,
|
|
@@ -35446,7 +35484,7 @@ function useVisitorTransactionService() {
|
|
|
35446
35484
|
} else if (item?.status && VALID_STATUSES.has(item.status)) {
|
|
35447
35485
|
status = item.status;
|
|
35448
35486
|
} else {
|
|
35449
|
-
throw new Error("Invalid
|
|
35487
|
+
throw new Error("Invalid Key Status");
|
|
35450
35488
|
}
|
|
35451
35489
|
await KeyRepo.updateKeyById(
|
|
35452
35490
|
item.keyId,
|