@7365admin1/core 3.129.3-staging.441 → 3.129.3-staging.442
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/hid-member-account-name.md +36 -0
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Use the account's own name for a property-management member, on the members list
|
|
6
|
+
and on the HID reader.
|
|
7
|
+
|
|
8
|
+
A membership carries whatever name was typed when the invitation was sent —
|
|
9
|
+
often an e-mail or a placeholder — while the account carries the name the person
|
|
10
|
+
set for themselves. The two diverge, and it was the membership's name that the
|
|
11
|
+
HID enrolment picker offered and that the reader displayed when it recognised
|
|
12
|
+
somebody.
|
|
13
|
+
|
|
14
|
+
Two changes, so that the picker, the HID roster and the door all say the same
|
|
15
|
+
thing:
|
|
16
|
+
|
|
17
|
+
`GET /api/members` now carries `userName`, the linked account's own name, beside
|
|
18
|
+
the membership's `name`. The aggregation already joined `users` for the e-mail,
|
|
19
|
+
so this only widens that lookup's projection; `name` itself is untouched and no
|
|
20
|
+
caller has to change. `projectionVersion` moves to 8 — it is part of the cache
|
|
21
|
+
key, so without the bump a page cached under the old projection would come back
|
|
22
|
+
without the new field for up to fifteen minutes.
|
|
23
|
+
|
|
24
|
+
`resolvePermissionUserBindings` now prefers the account's name when it builds a
|
|
25
|
+
property-management binding. That binding is what `provisionPermissionUser`
|
|
26
|
+
writes to the device, so this is the name the reader shows. One extra read for
|
|
27
|
+
the whole page rather than a lookup per member, and the membership name still
|
|
28
|
+
stands in wherever an account has none.
|
|
29
|
+
|
|
30
|
+
Residents are deliberately unchanged: their name comes from the `site.people`
|
|
31
|
+
record, which is the right source for a resident.
|
|
32
|
+
|
|
33
|
+
Worth knowing before deploying: the reader is rewritten for every binding during
|
|
34
|
+
a permission reconcile, not only for newly enrolled people, so staff who are
|
|
35
|
+
already enrolled will have their reader name updated to their account name the
|
|
36
|
+
next time a reconcile runs for that reader.
|
package/dist/index.js
CHANGED
|
@@ -4995,7 +4995,8 @@ function useMemberRepo() {
|
|
|
4995
4995
|
// 5: pages carry `total` (the Members "role from another site" banner).
|
|
4996
4996
|
// 6: rows carry unit + unitName (a unit's Management tab).
|
|
4997
4997
|
// 7: the other-site filter counts active roles of the member's own org only.
|
|
4998
|
-
|
|
4998
|
+
// 8: rows carry userName (the linked account's own name).
|
|
4999
|
+
projectionVersion: 8
|
|
4999
5000
|
};
|
|
5000
5001
|
if (org) {
|
|
5001
5002
|
try {
|
|
@@ -5077,13 +5078,18 @@ function useMemberRepo() {
|
|
|
5077
5078
|
localField: "user",
|
|
5078
5079
|
foreignField: "_id",
|
|
5079
5080
|
as: "users",
|
|
5080
|
-
pipeline: [{ $project: { email: 1, lastLoginAt: 1 } }]
|
|
5081
|
+
pipeline: [{ $project: { name: 1, email: 1, lastLoginAt: 1 } }]
|
|
5081
5082
|
}
|
|
5082
5083
|
},
|
|
5083
5084
|
{ $unwind: { path: "$users", preserveNullAndEmptyArrays: true } },
|
|
5084
5085
|
{
|
|
5085
5086
|
$project: {
|
|
5086
5087
|
name: 1,
|
|
5088
|
+
// The name on the ACCOUNT, beside the name on the membership.
|
|
5089
|
+
// They diverge - a membership is created with a name typed at
|
|
5090
|
+
// invite time and the person may have set their own since - so
|
|
5091
|
+
// both are carried and the caller chooses. `name` is unchanged.
|
|
5092
|
+
userName: "$users.name",
|
|
5087
5093
|
email: { $ifNull: ["$email", "$users.email"] },
|
|
5088
5094
|
user: 1,
|
|
5089
5095
|
lastLoginAt: "$users.lastLoginAt",
|
|
@@ -52345,13 +52351,27 @@ function useHidAmicoRepo() {
|
|
|
52345
52351
|
}, {
|
|
52346
52352
|
projection: { _id: 1, user: 1, name: 1, type: 1 }
|
|
52347
52353
|
}).toArray();
|
|
52354
|
+
const memberUserIds = members.map((member) => optionalObjectId2(member.user)).filter((userId) => Boolean(userId));
|
|
52355
|
+
const accountNames = /* @__PURE__ */ new Map();
|
|
52356
|
+
if (memberUserIds.length) {
|
|
52357
|
+
const accounts = await db2().collection("users").find({
|
|
52358
|
+
_id: { $in: memberUserIds }
|
|
52359
|
+
}, {
|
|
52360
|
+
projection: { _id: 1, name: 1 }
|
|
52361
|
+
}).toArray();
|
|
52362
|
+
accounts.forEach((account) => {
|
|
52363
|
+
const accountName = String(account.name || "").trim();
|
|
52364
|
+
if (accountName)
|
|
52365
|
+
accountNames.set(String(account._id), accountName);
|
|
52366
|
+
});
|
|
52367
|
+
}
|
|
52348
52368
|
members.forEach((member) => {
|
|
52349
52369
|
const userId = optionalObjectId2(member.user);
|
|
52350
52370
|
if (!userId)
|
|
52351
52371
|
return;
|
|
52352
52372
|
bindings.push({
|
|
52353
52373
|
userId,
|
|
52354
|
-
name: String(member.name || "Property Management"),
|
|
52374
|
+
name: accountNames.get(String(userId)) || String(member.name || "Property Management"),
|
|
52355
52375
|
category: "property_management",
|
|
52356
52376
|
member: member._id
|
|
52357
52377
|
});
|