@7365admin1/core 3.52.2 → 3.52.3-staging.243
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/.changeset/camera-error-wording-and-plate-cleanup.md +11 -0
- package/.changeset/plate-lookup-hides-deleted-plates.md +9 -0
- package/.changeset/plates-hidden-on-all-person-reads.md +16 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +301 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +301 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/anpr-revoke.test.mjs +124 -5
- package/test/e2e/vehicle-plate-read-paths.e2e.test.mjs +413 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Write camera failures in words an operator can act on, and stop offering plates whose vehicle has been deleted.
|
|
6
|
+
|
|
7
|
+
Camera failure messages no longer carry a camera's `_id`, its host, an IP, a port or a raw driver error. A camera is named by its display name and direction ("North Gate (entry)", or "the entry camera" when it has no name), and the reason is plain language ("the camera could not be reached"). The full technical detail — record id, host, and the device's or driver's own text — goes to the server log instead. The same treatment is applied to create, approve, restore, block, unblock, edit and delete; `blocklistVehicles`, `removeFromBlocklist` and `reactivateVehicleById` previously said only "Failed to delete/update/add plate number to ANPR", which named no camera and said nothing about what happened to the record. Blocking now states the opposite consequence to saving, because a failed blacklist write leaves the car able to get in.
|
|
8
|
+
|
|
9
|
+
`site.people.plates[]` no longer keeps a plate after its vehicle is deleted. The pull matched on `recNo`, which Dahua numbers per device, so the copy on the vehicle and the copy on the person diverged and the update silently matched nothing; it now matches on the plate number, and leaves the plate alone when a second live vehicle still holds it. Unblocking, which soft-deletes the record, now pulls the plate too. `GET /api/people/unit/:unit` and `GET /api/people` also drop any plate whose vehicle records are all deleted, so rows that had already drifted are not offered either. A plate the resident merely declared, with no vehicle record at all, is unchanged.
|
|
10
|
+
|
|
11
|
+
Unblocking a vehicle at a site with no ANPR camera now succeeds instead of failing with "No site cameras found." — there is nothing to revoke, which is the state the unblock is trying to reach. Approve, Restore, Block and Edit still refuse in that state, now saying why and what did not happen.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`GET /api/people/plateNumber/:plateNumber` now hides plates whose vehicle has been deleted, like the other person reads.
|
|
6
|
+
|
|
7
|
+
Its own filter is `status: { $ne: "deleted" }` on the **person**, which is unrelated to the vehicle — reading that line as "deleted plates are excluded" is why this endpoint was missed when the other two were fixed. It has no caller in the estate today, but it is routed and behind `requireAuth`, so an authenticated caller gets the resident's whole `plates[]` array back. The filter runs on read, after the cache, because whether a plate's vehicle is deleted can change inside the 15-minute TTL.
|
|
8
|
+
|
|
9
|
+
`getPersonByPlateNumber` (no caller, no route) and `getApprovedPersonByPlateNumber` (a record-matching path inside `person.service.ts`, not a display path) are deliberately left alone.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Hide deleted plates on every person read, not only on the two browse paths.
|
|
6
|
+
|
|
7
|
+
A vehicle's plate number is copied onto the resident's record as `site.people.plates[]`. Deleting the vehicle is meant to take it back out, and where that copy had already drifted the read paths filter it against the vehicle record. That filter was only on `GET /api/people` and `GET /api/people/unit/:unit`, so four other endpoints still handed back a plate whose only vehicle is deleted:
|
|
8
|
+
|
|
9
|
+
- `GET /api/people/plateNumber/:plateNumber`
|
|
10
|
+
- `GET /api/people/nric/:nric` (the MA app's NRIC lookup, and layer-common's `findPersonByNRIC`)
|
|
11
|
+
- `GET /api/people/contact/:contact`
|
|
12
|
+
- `GET /api/people/all-nric` (the MA app's NRIC search)
|
|
13
|
+
|
|
14
|
+
Each of the four now applies the same filter. `status: { $ne: "deleted" }` on three of those queries is the PERSON's status and has nothing to do with the vehicle — reading it as "deleted plates are excluded" is how they were missed. The filter runs on the way out, after the Redis read, so a plate deleted inside the 15-minute cache window disappears immediately rather than at the next expiry.
|
|
15
|
+
|
|
16
|
+
Unchanged: a plate the resident merely declared, with no vehicle record at all, is still listed; a plate a second live vehicle still holds is still listed.
|
package/dist/index.d.ts
CHANGED
|
@@ -2528,6 +2528,14 @@ type AnprRevokeOutcome = {
|
|
|
2528
2528
|
statusCode?: number;
|
|
2529
2529
|
/** Why it failed, in words an operator can act on. Empty when `ok`. */
|
|
2530
2530
|
reason: string;
|
|
2531
|
+
/**
|
|
2532
|
+
* The technical cause, for the SERVER LOG only. Never rendered.
|
|
2533
|
+
*
|
|
2534
|
+
* `reason` used to BE this string, so a driver error went straight to the
|
|
2535
|
+
* browser: "connect EHOSTUNREACH 129.126.212.21:8081" put an internal IP and
|
|
2536
|
+
* port in front of a condo manager, who can do nothing with either.
|
|
2537
|
+
*/
|
|
2538
|
+
detail?: string;
|
|
2531
2539
|
};
|
|
2532
2540
|
|
|
2533
2541
|
declare enum CameraType {
|
|
@@ -5048,7 +5056,13 @@ declare function usePersonRepo(): {
|
|
|
5048
5056
|
nric?: string | undefined;
|
|
5049
5057
|
sort?: Record<string, any> | undefined;
|
|
5050
5058
|
site: string;
|
|
5051
|
-
}) => Promise<{
|
|
5059
|
+
}) => Promise<{
|
|
5060
|
+
items: any[];
|
|
5061
|
+
pages: number;
|
|
5062
|
+
pageRange: string;
|
|
5063
|
+
} | {
|
|
5064
|
+
items: TPerson[];
|
|
5065
|
+
}>;
|
|
5052
5066
|
pushVehicleById: (id: string | ObjectId, plate: {
|
|
5053
5067
|
plateNumber: string;
|
|
5054
5068
|
recNo: string;
|