@7365admin1/core 3.32.2-staging.50 → 3.32.2-staging.52
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.js +18 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14976,29 +14976,36 @@ function usePersonRepo() {
|
|
|
14976
14976
|
async function updatePlateNumberByUserId(userId, plateNumber, session) {
|
|
14977
14977
|
const user = (0, import_node_server_utils28.toObjectId)(userId);
|
|
14978
14978
|
try {
|
|
14979
|
-
await collection.updateOne(
|
|
14979
|
+
const result = await collection.updateOne(
|
|
14980
14980
|
{ user },
|
|
14981
14981
|
{
|
|
14982
14982
|
$set: {
|
|
14983
|
+
plateNumber,
|
|
14983
14984
|
"plates.0.plateNumber": plateNumber,
|
|
14984
|
-
"plateNumber": plateNumber,
|
|
14985
14985
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14986
14986
|
}
|
|
14987
14987
|
},
|
|
14988
14988
|
{ session }
|
|
14989
14989
|
);
|
|
14990
|
-
|
|
14990
|
+
if (result.matchedCount === 0) {
|
|
14991
|
+
throw new import_node_server_utils28.BadRequestError("Person not found for this user.");
|
|
14992
|
+
}
|
|
14993
|
+
try {
|
|
14994
|
+
await delNamespace();
|
|
14991
14995
|
import_node_server_utils28.logger.info(
|
|
14992
14996
|
`Cache cleared for namespace: ${site_people_namespace_collection}`
|
|
14993
14997
|
);
|
|
14994
|
-
}
|
|
14998
|
+
} catch (err) {
|
|
14995
14999
|
import_node_server_utils28.logger.error(
|
|
14996
15000
|
`Failed to clear cache for namespace: ${site_people_namespace_collection}`,
|
|
14997
15001
|
err
|
|
14998
15002
|
);
|
|
14999
|
-
}
|
|
15003
|
+
}
|
|
15000
15004
|
return "Successfully updated plate number.";
|
|
15001
15005
|
} catch (error) {
|
|
15006
|
+
if (error instanceof import_node_server_utils28.BadRequestError) {
|
|
15007
|
+
throw error;
|
|
15008
|
+
}
|
|
15002
15009
|
throw new import_node_server_utils28.InternalServerError("Failed to update plate number.");
|
|
15003
15010
|
}
|
|
15004
15011
|
}
|
|
@@ -27365,14 +27372,10 @@ function useVehicleService() {
|
|
|
27365
27372
|
if (hasSecurityBypass) {
|
|
27366
27373
|
addedByPM = true;
|
|
27367
27374
|
}
|
|
27368
|
-
|
|
27369
|
-
value.status = "active" /* ACTIVE */;
|
|
27370
|
-
}
|
|
27375
|
+
value.status = "active" /* ACTIVE */;
|
|
27371
27376
|
if (addedBySecurity && !hasSecurityBypass) {
|
|
27372
27377
|
value.status = "pending" /* PENDING */;
|
|
27373
27378
|
}
|
|
27374
|
-
if (isBlocklist)
|
|
27375
|
-
value.status = "inactive" /* INACTIVE */;
|
|
27376
27379
|
const _type = value.type;
|
|
27377
27380
|
const _mode = isBlocklist ? "TrafficBlackList" /* TRAFFIC_BLACKLIST */ : "TrafficRedList" /* TRAFFIC_REDLIST */;
|
|
27378
27381
|
const hasStart = typeof value.start === "string" ? value.start.trim() !== "" : !!value.start;
|
|
@@ -27438,6 +27441,11 @@ function useVehicleService() {
|
|
|
27438
27441
|
end
|
|
27439
27442
|
};
|
|
27440
27443
|
if (vehicleValue.status && vehicleValue.status !== "pending" /* PENDING */) {
|
|
27444
|
+
const siteObjectId = new import_mongodb50.ObjectId(vehicleValue.site);
|
|
27445
|
+
const existingPlateNumber = await findOne({ plateNumber, site: siteObjectId });
|
|
27446
|
+
if (existingPlateNumber) {
|
|
27447
|
+
throw new import_node_server_utils78.BadRequestError(`Vehicle plate number ${plateNumber} already exists.`);
|
|
27448
|
+
}
|
|
27441
27449
|
for (const camera of siteCameras) {
|
|
27442
27450
|
const { host, username, password } = camera;
|
|
27443
27451
|
const plateNumber2 = vehicleValue.plateNumber;
|