@7365admin1/core 3.99.1-staging.380 → 3.99.1-staging.382
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 +23 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/scripts/resident-role-check.mjs +118 -0
- package/test/e2e/invite-roles-owner-reach.e2e.test.mjs +73 -0
- package/test/resident-role-assignment.test.mjs +105 -0
package/dist/index.js
CHANGED
|
@@ -46253,11 +46253,33 @@ function usePersonService() {
|
|
|
46253
46253
|
const { updateStatusById } = useFileRepo();
|
|
46254
46254
|
const { getById: getOrgById } = useOrgRepo();
|
|
46255
46255
|
const { getSiteById } = useSiteRepo();
|
|
46256
|
+
const { getRoleByName } = useRoleRepo();
|
|
46256
46257
|
const { add: addVehicle } = useVehicleService();
|
|
46257
46258
|
const {
|
|
46258
46259
|
acceptByUserId: _acceptTermsByUserId,
|
|
46259
46260
|
assertLatestTerms: _assertLatestTerms
|
|
46260
46261
|
} = usePlatformTermsService();
|
|
46262
|
+
const RESIDENT_ROLE_NAME = "hid-resident";
|
|
46263
|
+
const RESIDENT_ROLE_TYPE = "resident";
|
|
46264
|
+
async function resolveResidentRoleId() {
|
|
46265
|
+
try {
|
|
46266
|
+
const role = await getRoleByName(RESIDENT_ROLE_NAME, RESIDENT_ROLE_TYPE);
|
|
46267
|
+
const roleId = role?._id?.toString() || "";
|
|
46268
|
+
if (!roleId) {
|
|
46269
|
+
import_node_server_utils142.logger.log({
|
|
46270
|
+
level: "error",
|
|
46271
|
+
message: `No '${RESIDENT_ROLE_NAME}' role of type '${RESIDENT_ROLE_TYPE}' exists; the resident member will be created without one.`
|
|
46272
|
+
});
|
|
46273
|
+
}
|
|
46274
|
+
return roleId;
|
|
46275
|
+
} catch (error) {
|
|
46276
|
+
import_node_server_utils142.logger.log({
|
|
46277
|
+
level: "error",
|
|
46278
|
+
message: `Failed to resolve the '${RESIDENT_ROLE_NAME}' role: ${error?.message}`
|
|
46279
|
+
});
|
|
46280
|
+
return "";
|
|
46281
|
+
}
|
|
46282
|
+
}
|
|
46261
46283
|
async function ensureResidentAccount(value, session) {
|
|
46262
46284
|
const gap = residentAccountGapMessage(value);
|
|
46263
46285
|
if (gap) {
|
|
@@ -46305,7 +46327,7 @@ function usePersonService() {
|
|
|
46305
46327
|
orgName: org?.name || "",
|
|
46306
46328
|
user: userId.toString(),
|
|
46307
46329
|
name: value.name,
|
|
46308
|
-
role:
|
|
46330
|
+
role: await resolveResidentRoleId(),
|
|
46309
46331
|
type: "resident",
|
|
46310
46332
|
siteId: value.site?.toString() || "",
|
|
46311
46333
|
siteName: site?.name || ""
|