@7365admin1/core 3.32.2-staging.50 → 3.32.2-staging.51
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 +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- 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
|
}
|